文档详情

Matlab的GUI回调函数.doc

发布:2016-12-10约4.96千字共3页下载文档
文本预览下载声明
Kinds of Callbacks The following table lists the callback properties that are available, their triggering events, and the components to which they apply. Note:User interface controls include push buttons, sliders, radio buttons, check boxes, editable text boxes, static text boxes, list boxes, and toggle buttons. They are sometimes referred to as uicontrols. GUIDE Callback Arguments All callbacks in a GUIDE-generated GUI code file have the following standard input arguments: hObject — Handle of the object, e.g., the GUI component, for which the callback was triggered. For a button group SelectionChangeFcn callback, hObject is the handle of the selected radio button or toggle button. eventdata — Sequences of events triggered by user actions such as table selections emitted by a component in the form of a MATLAB struct (or an empty matrix for components that do not generate eventdata) handles — A MATLAB struct that contains the handles of all the objects in the GUI, and may also contain application-defined data. See handles Structure for information about this structure. Object Handle The first argument is the handle of the component issuing the callback. Use it to obtain relevant properties that the callback code uses and change them as necessary. For example, theText = get(hObject,String); places the String property (which might be the contents of static text or name of a button) into the local variable theText. You can change the property by setting it, for example set(hObject,String,date) This particular code changes the text of the object to display the current date. Event Data Event data is a stream of data describing user gestures, such as key presses, scroll wheel movements, and mouse drags. The auto-generated callbacks of GUIDE GUIs can access event data for Handle Graphics? and uicontrol and uitable object callbacks. The following ones receive event data when triggered: CellEditCallback in a uitable CellSelectionCallback in a uitable KeyPressFcn
显示全部
相似文档