MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Betriebsanweisung Seite 370

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 759
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 369
9 Managing and Sh aring Application Data in GUIDE
guidata(hObject, handles);
When you select the pencil tool and click in the icon-editing area, the Icon
Editor calls the pencil too l function:
% in iconEditor
function ico nEdi tor_WindowButtonDownFcn (hObject,...
eventdata, ha ndle s)
toolPalette = handles.toolPalette;
toolPaletteHandles = guidata(to olPalette);
.
.
.
userData = get(toolPaletteHandl es.mCurrentTool, 'UserData');
handles.mIconCData = userData.C allback(toolPaletteHand les, ...
toolPaletteHandles.mCurrentTool, handles.mIconCData, ...);
The following code shows how the pixel value in the icon-editing area under
the mouse click (the Tool icon’s
CData) changes to the color currently selected
in the Color Palette:
% in toolPalette
function cda ta = pencilToolCallback(handles, toolstruct, cdata,...)
iconEditor = handles.iconEditor;
iconEditorHandles = guidata(ico nEditor);
x = ...
y = ...
% update color of the selected block
color = iconEditorHandles.getCo lor(iconEditor);
cdata(y, x,: ) = color;
Displaying the Current Tool’s Cursor
You can have the cursor display the current tools pointer icon when the
mouse is in the editing area and the default arrow displays outside the
editing area. To do this yo u m u s t identify the selected too l th ro ugh the Tool
Palette’s
handles structure:
% in Icon E dito r
function ico nEdi tor_WindowButtonMotionF cn(hObject, ...
eventdata, han dles )
9-40
Seitenansicht 369
1 2 ... 365 366 367 368 369 370 371 372 373 374 375 ... 758 759

Kommentare zu diesen Handbüchern

Keine Kommentare