diff --git a/FL/Fl_Choice.H b/FL/Fl_Choice.H index 8146f9476..1f93fb40a 100644 --- a/FL/Fl_Choice.H +++ b/FL/Fl_Choice.H @@ -38,10 +38,17 @@ often to control a single variable rather than do individual callbacks, some of the Fl_Menu_Button methods are redescribed here in those terms. - When the user picks an item off the menu the value() is set to that item - and then the item's callback is done with the menu_button as the - \c Fl_Widget* argument. If the item does not have a callback the - menu_button's callback is done instead. + When the user clicks a menu item, value() is set to that item + and then: + + - The item's callback is done if one has been set; the + Fl_Choice is passed as the Fl_Widget* argument, + along with any userdata configured for the callback. + + - If the item does not have a callback, the Fl_Choice widget's + callback is done instead, along with any userdata configured + for it. The callback can determine which item was picked using + value(), mvalue(), item_pathname(), etc. All three mouse buttons pop up the menu. The Forms behavior of the first two buttons to increment/decrement the choice is not implemented. This diff --git a/FL/Fl_Input_Choice.H b/FL/Fl_Input_Choice.H index fc307a9fe..efcbf8e9a 100644 --- a/FL/Fl_Input_Choice.H +++ b/FL/Fl_Input_Choice.H @@ -43,10 +43,54 @@ The user can either type into the input area, or use the menu button chooser on the right to choose an item which loads the input area with the selected text. -
+
The application can directly access both the internal Fl_Input
and Fl_Menu_Button widgets respectively using the input() and menubutton()
accessor methods.
+
+ The default behavior is to invoke the Fl_Input_Choice::callback()
+ if the user changes the input field's contents, either by typing,
+ pasting, or clicking a different item in the choice menu.
+
+ The callback can determine if an item was picked vs. typing
+ into the input field by checking the value of menubutton()->changed(),
+ which will be:
+
+ - 1: the user picked a different item in the choice menu
+ - 0: the user typed or pasted directly into the input field
+
+ Example use:
+ \code
+ #include
Submenus will also pop up in response to shortcuts indicated by putting a '&' character in the name field of the menu item. If you put a diff --git a/FL/Fl_Menu_Button.H b/FL/Fl_Menu_Button.H index 6a556aeb3..7f18eab66 100644 --- a/FL/Fl_Menu_Button.H +++ b/FL/Fl_Menu_Button.H @@ -42,10 +42,18 @@ callbacks exactly the same as when you pick the item with the mouse. The '&' character in menu item names are only looked at when the menu is popped up, however.
-When the user picks an item off the menu, the item's callback is - done with the menu_button as the Fl_Widget* argument. If the - item does not have a callback the menu_button's callback is done - instead. + + When the user clicks a menu item, value() is set to that item + and then: + + - The item's callback is done if one has been set; the + Fl_Menu_Button is passed as the Fl_Widget* argument, + along with any userdata configured for the callback. + + - If the item does not have a callback, the Fl_Menu_Button's callback + is done instead, along with any userdata configured for it. + The callback can determine which item was picked using + value(), mvalue(), item_pathname(), etc. */ class FL_EXPORT Fl_Menu_Button : public Fl_Menu_ { protected: