2014.04.16, reading, reading notes-"Matlab r2014a fully self-taught a pass"-17th Chapter Graphical user interface

Source: Internet
Author: User
Tags uicontrol

The interface objects are divided into three categories:

    1. User Control object (Uicontrol)
    2. Drop-down Menu object (Uimenu)
    3. Content-Style Menu object (uicontextmenu)

To create a user interface:

1. Command-line mode

Use Uicontrol to create a control object. Used in

    • Handle=uicontrol (parent)
    • Handle=uicontrol (..., ' property name ', property value, ' property name ', property value,...)

Ex17-1:

H=uicontrol (' style ',' pushbutton ', 'Units ',' normalized ',' Position ', [. 5.5.2.1],' String ',' Click here ',' Callback ',' Set (H, ' Position ', [. 8*rand. 9*rand. 2. 1]);

2.GUI Design Tools

Slightly

All handle graphic images have a BUTTONDOWNFCN property, most UI objects also have a callback property, a KEYPRESSFCN property for Uicontrol objects, and a graphical object from WINDOWSBUTTONDOWNFCN, WINDOWBUTTONUPFCN and so on attributes.

To execute the button's click command on the Buttons object, you can set it to:

H_uic=uicontrol (' Style ', ' pushbutton ', ' Callback ', ' BUTTONFCN click ')

Ex17-3:

The qualifying conditions are added in the first two edit callback:

Input=str2num (get(hobject,' String ')); The% check is null if empty, shown as 0if  (IsEmpty (input))    set(hobject,' String ', ' 0 ' ) Endguidata (hobject,handles);

A calculated event was added to the callback of the button:

A=Get(handles.edit1,' string'); b=get(handles.edit2,' string '); Total =str2num (a) +Str2Num (b), c=num2str (total); % Update calculation result set(handles.edit3,' String ', c); the% update graphic object handle, the general callback callback function has guidata (hobject,handles) to end the updated data. Guidata (hobject,handles);

2014.04.16, reading, reading notes-"Matlab r2014a fully self-taught a pass"-17th Chapter Graphical user interface

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.