Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Guide & Mouse Event

2008.11.27

Computational Physics
Sogang Univ. Of Physics
Guide & Mouse Event 2

Advantages of Using Guide

Simplicity of Layout
Graphical layout is intuitive for GUI development and provides a
well organized structure for complex designs
Automatic Code Generation
Guide will generate callback function code and main GUI code
allowing you to focus on details of the GUI design
Object Property Control
The property inspector and object browser provide a complete view
of available properties and hierarchy allowing you to modify GUI
component behavior efficiently
But
Using Guide for high-level development does not eliminate the
possibility of using low-level UIcontrol and UImenu functions within
your code
Guide & Mouse Event 3

Getting started with Guide

Write guide in command window or press the button in


menubar.

guide
guide fui_name
Guide & Mouse Event 4

Guide options

Besize Behavior
Non-resizable
Proportional
Other(Use ResizeFcn)
Command-line Accessibility
Callback(Gui becomes current figure within callbacks)
Off(Gui never becomes current figure)
On(Gui may become figure from command line)
Other(Use settings from property inspector)
Generate fig-file and M-file
generate callback function prototypes
Gui allows only one instance to run(single ton)
Use system color scheme for background
Generate fig-file only
Guide & Mouse Event 5

property inspector & object browser

Property Inspector
Double click a Gui object(quickest)
Right click over a Gui object and select property inspector from
the item list
Click the property Inspector icon on the shortcut toolbar in Guide
Object Browser
Right click over a Gui object and select Object Browser from the
item list
Click the Object Browser icon on the shortcut toolbar in Guide
Guide & Mouse Event 6

Example
Guide & Mouse Event 7

Mouse Event
Mouse Event Callback Associated Basic Description
Function HG Objects
WindowButtonDownFcn Figure callback fcn that executes
when mouse button is
pressed within a figure
window
WindowButtonUpFcn Figure calback fcn that executes
when mouse button is
depressed within a figure
window
WindowButtonMotionFcn Figure callback fcn that executes
when mouse moves within
a figure window
ButtonDownFcn All objects callback fcn that executes
whenever either a left or
right mouse button is
pressed over an object.
Guide & Mouse Event 8

Mouse Event Properties

HG Object Property Basic Description


Axes CurrentPoint,[x y z] mouse coordinate location
in current Axes units at the
position of the most recent
mouse button click
Figure CurrentPoint,[x y] mouse coordinate location
in current Figure units at
the position of the most
recent mouse button click
SelectionType holds information refarding
the most recent mouse
button event type that
occurred in a figure
window
Root PointerLocation,[x y] mouse coordinate location
from the bottom left of the
display screen
Guide & Mouse Event 9

Example
Guide & Mouse Event 10

Exercise

Make main_gui2 using GUIDE program.


When you input function in edit text box and push the
update plot button, the plot of the input function is
drawn in the axes.
When you push the close button, current figure window is
closed.
Add a Uicontextmenu which can control the style and
color of the plot.

You might also like