MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Manual do Utilizador Página 242

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 330
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 241
10 Examples of GUIDE GUIs
10-18
Enabling Multiple Selection
To enable multiple selection in a list box, you must set the Min and Max
properties so that
Max Min > 1. This requires you to change the default Min
and
Max values of 0 and 1 to meet these conditions. Use the Property Inspector
to set these properties on the list box.
How Users Select Multiple Items
List box multiple selection follows the standard for most systems:
Control-click left mouse button — noncontiguous multi-item selection
Shift-click left mouse button — contiguous multi-item selection
Users must use one of these techniques to select the two variables required to
create the plot.
Returning Variable Names for the Plotting Functions
The get_var_names subroutine returns the two variable names that are
selected when the user clicks on one of the three plotting buttons. The function
Gets the list of all items in the list box from the
String property.
Gets the indices of the selected items from the
Value property.
Returns two string variables, if there are two items selected. Otherwise
get_var_names displays an error dialog explaining that the user must select
two variables.
Here is the code for
get_var_names:
function [var1,var2] = get_var_names(handles)
list_entries = get(handles.listbox1,'String');
index_selected = get(handles.listbox1,'Value');
if length(index_selected) ~= 2
errordlg('You must select two variables',...
'Incorrect Selection','modal')
else
var1 = list_entries{index_selected(1)};
var2 = list_entries{index_selected(2)};
end
Vista de página 241
1 2 ... 237 238 239 240 241 242 243 244 245 246 247 ... 329 330

Comentários a estes Manuais

Sem comentários