From b4995f979d127cea667b4e2b71c91e9db4ab52ef Mon Sep 17 00:00:00 2001 From: maxim nikonov Date: Fri, 6 Feb 2026 18:12:40 +0500 Subject: wip --- FL/Fl_Browser.H | 3 ++- FL/Fl_Input_Choice.H | 3 ++- FL/Fl_Menu_.H | 3 ++- FL/Fl_Table.H | 9 ++++++--- FL/Fl_Tree.H | 11 +++++++---- FL/Fl_Tree_Item.H | 6 ++++-- 6 files changed, 23 insertions(+), 12 deletions(-) (limited to 'FL') diff --git a/FL/Fl_Browser.H b/FL/Fl_Browser.H index ef5064171..7da8a7219 100644 --- a/FL/Fl_Browser.H +++ b/FL/Fl_Browser.H @@ -73,7 +73,8 @@ struct FL_BLINE; Some common coding patterns used for working with Fl_Browser: \code // How to loop through all the items in the browser - for ( int t=1; t<=browser->size(); t++ ) { // index 1 based..! + int t; + for (t =1; t<=browser->size(); t++ ) { // index 1 based..! printf("item #%d, label='%s'\n", t, browser->text(t)); } \endcode diff --git a/FL/Fl_Input_Choice.H b/FL/Fl_Input_Choice.H index b2023052f..5284882c8 100644 --- a/FL/Fl_Input_Choice.H +++ b/FL/Fl_Input_Choice.H @@ -182,7 +182,8 @@ public: Fl_Input_Choice *choice = new Fl_Input_Choice(100,10,120,25,"Choice:"); [..] // Print all the items in the choice menu - for ( int t=0; tmenubutton()->size(); t++ ) { + int t; + for (t =0; tmenubutton()->size(); t++ ) { const Fl_Menu_Item &item = choice->menubutton()->menu()[t]; printf("item %d -- label=%s\n", t, item.label() ? item.label() : "(Null)"); } diff --git a/FL/Fl_Menu_.H b/FL/Fl_Menu_.H index f0ddf59d7..c2bf5eed8 100644 --- a/FL/Fl_Menu_.H +++ b/FL/Fl_Menu_.H @@ -119,7 +119,8 @@ public: \b Example: How to walk the array: \code - for ( int t=0; tsize(); t++ ) { // walk array of items + int t; + for (t =0; tsize(); t++ ) { // walk array of items const Fl_Menu_Item &item = menubar->menu()[t]; // get each item fprintf(stderr, "item #%d -- label=%s, value=%s type=%s\n", t, diff --git a/FL/Fl_Table.H b/FL/Fl_Table.H index 80a96593c..94b249b4b 100644 --- a/FL/Fl_Table.H +++ b/FL/Fl_Table.H @@ -679,7 +679,8 @@ public: same value, in pixels. The screen is redrawn. */ void row_height_all(int height) { // set all row/col heights - for ( int r=0; rlabel()); \endcode \par @@ -196,7 +197,8 @@ \par \code // Walk all the items in the tree, and print their labels - for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) { + Fl_Tree_Item *item; + for (item = tree->first(); item; item = tree->next(item) ) { printf("Item: %s\n", item->label()); } \endcode @@ -207,7 +209,8 @@ \code // Find all of the item's children and print an indented report of their labels void my_print_all_children(Fl_Tree_Item *item, int indent=0) { - for ( int t=0; tchildren(); t++ ) { + int t; + for (t =0; tchildren(); t++ ) { printf("%*s Item: %s\n", indent, "", item->child(t)->label()); my_print_all_children(item->child(t), indent+4); // recurse } @@ -230,7 +233,7 @@ \par \code // Change the font and color of all items currently in the tree - for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) { + for (item = tree->first(); item; item = tree->next(item) ) { item->labelfont(FL_COURIER); item->labelcolor(FL_RED); } diff --git a/FL/Fl_Tree_Item.H b/FL/Fl_Tree_Item.H index ba5188219..3290bf523 100644 --- a/FL/Fl_Tree_Item.H +++ b/FL/Fl_Tree_Item.H @@ -323,7 +323,8 @@ public: select(); ++count; } - for ( int t=0; tselect_all(); } return(count); @@ -342,7 +343,8 @@ public: deselect(); ++count; } - for ( int t=0; tdeselect_all(); } return(count); -- cgit v1.2.3