Phidgets Inc.
2
GUI Layout
A program with a GUI is composed of one or more “forms”. The forms contain all of the ele-ments necessary to interact with the computer in a graphical environment. The form for thisprogram is the grey box on the screen. Mostprograms that you will be writing for Phidgets,at least to begin with, will only use one form.Applications that make use of more than oneare often substantially more complicated toprogram. The screen you see now is calledthe “Form Designer”.
It is useful to rst set up your workspace. If
the “Toolbox” panel is not already visible, open the “View” menu ( 1 ) and select “Toolbox”. To ensurethe Toolbox panel does not cover the form you are going to be working on, toggle the “pin” button ( 2).The various elements of the GUI, known as controls, can be placed in whatever order you wish and in
any location you wish within the form. For this example, we will rst place the “Labels”( 3 ) which will beused to display information. Under the “All Windows Forms” rollout, select Label. Click somewhere in
the middle and upper region of the form. Repeat this action to create three labels. ‘
label1
’ will be usedto display the tag code whenever an RFID tag is brought into the scanning distance of the antenna.‘
label2
’ will be used to represent the connection status of the RFID reader, and ‘
label3
’ will be used todisplay the serial number of the connected Phidget. Note the names of your labels and the order theyappear on the form, they should follow the order shown here.When working with the labels and controls in general, it is often useful to open the layout toolbar by
selecting View ( 1 ) >> Toolbars >> Layout. The layout toolbar provides many helpful tools for aligningelements on the form. Select the three labels you created and perform a “Left Align” ( 4 ). If your labels
are spread out vertically you can also try clicking “Make Vertical Spacing Equal” ( 5 ). You can movethe labels as a group into whatever position you wish.Finally, select the ”CheckBox” tool ( 6 ) and as in the same manner as the labels, create a checkbox un-der the labels. Repeat this process to create a second checkbox under the previously created check-box. Select the two checkboxes and click “Center Horizontally” ( 7 ) on the layout toolbar.At this stage, experimentation is encouraged to create a satisfactory look.
123345676
Add a Comment