Documentation‎ > ‎Commands‎ > ‎

gnocl::signalEmit

This command will generate trigger named signals for a specified widget.

Synoposis

gnocl::signalEmit widget-id signal-type

Options

The following includes a list of those signal types specified within the Gtk widget set source code. The range of signals supported by widgets varies and those programmers wishing to using this command are advised to consult the Gtk API documentation for more more specific details.  

clicked
event
button_press_event
button_release_event
scroll_event
motion_notify_event
delete_event
destroy_event
expose_event
key_press_event
key_release_event
enter_notify_event
leave_notify_event
configure_event
focus_in_event
focus_out_event
map_event
unmap_event
property_notify_event
selection_clear_event
selection_request_event
selection_notify_event
proximity_in_event
focusIn
proximity_out_event
visibility_notify_event
client_event
no_expose_event
window_state_event


NOTE: The above list is experimental and subject to change. Whilst the event names are exactly those used internally by the Gtk+ libraries, these are not consistent with the established Gnocl naming conventions which, for example, would prefer 'buttonPress' rather than 'button_press_event'.

Description


The gnocl::signalEvent command effectively emulates the function of user interaction. Alternatively, it may be used to programmatically trigger widget events. The following example illustrates how, the script defined in the binding to a toolbar button can be triggered via a menu operation.

Example

...

# toolbar item
set saveAs_ [$app(toolBar1) add item \
    -icon "%#SaveAs" \
    -text "SaveAs" \
    -onClicked {
            getData $list
            set fileName [gnocl::fileChooserDialog \
                -action save \
                -overwriteConfirm 1 \
                -fileFilters $fileTypes \
                -currentFolder ./projects \
                -title "Save Project File"]
            saveList $fileName
        }]

...

# menu item
$app(menu,file) addBegin [gnocl::menuItem \
    -icon %#SaveAs \
    -text "Save As.." \
    -onClicked { gnocl::signalEmit $saveAs_ "clicked"  }]

...

Comments