
Examples: Programming GUI Components
8-23
Triggering Callback Execution
For both UNIX and Windows, clicking inside the GUI but outside the edit text
causes the edit text callback to execute. The user can also press
Enter for an
edit text that allows only a single line of text, or
Ctrl+Enter for an edit text that
allows multiple lines.
Available Keyboard Accelerators
GUI users can use the following keyboard accelerators to modify the content of
an edit text. These accelerators are not modifiable.
• Ctrl+X – Cut
• Ctrl+C – Copy
• Ctrl+V – Paste
• Ctrl+H – Delete last character
• Ctrl+A – Select all
Slider
You can determine the current value of a slider from within its callback by
querying its
Value property, as illustrated in the following example:
function slider1_Callback(hObject, eventdata, handles)
slider_value = get(hObject,'Value');
% Proceed with callback...
The Max and Min properties specify the slider’s maximum and minimum values.
The slider’s range is
Max - Min.
List Box
When the list box Callback callback is triggered, the list box Value property
contains the index of the selected item, where
1 corresponds to the first item in
the list. The
String property contains the list as a cell array of strings.
This example retrieves the selected string. It assumes
listbox1 is the value of
the
Tag property. Note that it is necessary to convert the value returned from
the
String property from a cell array to a string.
Komentarze do niniejszej Instrukcji