Widget callbacks » History » Revision 3
Revision 2 (iri, 02/28/2011 12:03 AM) → Revision 3/26 (iri, 02/28/2011 01:58 PM)
h1. Widget callbacks A signal will be emitted when an event occurs on a widget. To run any actions when a signal is emitted, you should define a _callback_, a function will run these actions. Here, you can define all callbacks with an one function : *_gtkWidgetCB* Its prototype is : *fun [ObjGtkWidget u1 u0 I I] ObjGtkWidget* # *ObjGtkWidget* : Scol object : the widget # *u1* : the prototype of the callback (see below) # *u0* : the user parameter, at your convenience # *I* : the flag of the callback = which signal is affected ? (see below) # *I* : the mask : propagate or not the signal to the container ? Two values are availables * SCOL_GTK_SIGNAL_MASK_PROPAGATE * SCOL_GTK_SIGNAL_MASK_STOP +Warning+ : the prototype of the callback is different for each flag ! Flag currently availables : h2. SCOL_GTK_WIDGET_BUTTONPRESSED a mouse button has been pressed on a widget. Prototype : *fun [ObjGtkWidget u0 I I I [I I]] u2* table |1. *widget*|ObjGtkWidget|a widget| | |2. *userparam*|u0|a h3. 1. the widget h3. 2. the user parameter, at your convenience| | |3. *signal*|I|the parameter h3. 3. the type of the signal|SCOL_GTK_EVENT_BUTTON_PRESSED signal : * SCOL_GTK_EVENT_BUTTON_PRESSED (one click),| | | | |SCOL_GTK_EVENT_BUTTON_PRESSED2 click), * SCOL_GTK_EVENT_BUTTON_PRESSED2 (double click),| click), | | | |SCOL_GTK_EVENT_BUTTON_PRESSED3 * SCOL_GTK_EVENT_BUTTON_PRESSED3 (triple click),| click), | | | |SCOL_GTK_EVENT_BUTTON_RELEASE * SCOL_GTK_EVENT_BUTTON_RELEASE (button released).| released). | | | |So So you can make one function to several definitions| |4. *button*|I|the definitions h3. 4. The mouse button|SCOL_GTK_EVENT_BUTTON_1,| button : * SCOL_GTK_EVENT_BUTTON_1, | | | |SCOL_GTK_EVENT_BUTTON_2,| * SCOL_GTK_EVENT_BUTTON_2, | | | |SCOL_GTK_EVENT_BUTTON_3,| * SCOL_GTK_EVENT_BUTTON_3, | | | |SCOL_GTK_EVENT_BUTTON_4,| * SCOL_GTK_EVENT_BUTTON_4, | | | |SCOL_GTK_EVENT_BUTTON_5,| |5. *mask*|I|the * SCOL_GTK_EVENT_BUTTON_5 h3. 5. The mask of the modifier keys|SCOL_GTK_EVENT_KEY_SHIFT| keys * SCOL_GTK_EVENT_KEY_SHIFT, | | | |SCOL_GTK_EVENT_KEY_CONTROL,| * SCOL_GTK_EVENT_KEY_CONTROL, | | | |SCOL_GTK_EVENT_KEY_ALT,| * SCOL_GTK_EVENT_KEY_ALT, | | | |SCOL_GTK_EVENT_KEY_CAPS, (can not be| * SCOL_GTK_EVENT_KEY_CAPS, | | | |SCOL_GTK_EVENT_KEY_HYPER,| * SCOL_GTK_EVENT_KEY_HYPER, | | | |SCOL_GTK_EVENT_KEY_SUPER,| * SCOL_GTK_EVENT_KEY_SUPER, | | | |SCOL_GTK_EVENT_KEY_OTHER * SCOL_GTK_EVENT_KEY_OTHER (or nothing)| |6. *position*|I|the nothing) h3. 6. the position of the click [x y], relative to the widget| | h2. SCOL_GTK_WIDGET_BUTTONRELEASED a mouse button has been released on a widget. Prototype : *fun [ObjGtkWidget u0 I I I [I I]] u2* See 'SCOL_GTK_WIDGET_BUTTONPRESSED' above. widget Return [[Widgets]]