home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
windows
/
kpwdemo.zip
/
DESIGN.HYP
< prev
next >
Wrap
Text File
|
1990-06-28
|
15KB
|
399 lines
//DESIGN a screen
DESIGN lets you interactively design screen interfaces.
Point and click the mouse to select a help subject:
#mDesign the interface#m
#mCreate the code#m
#mUsing the code#m
#mSave the interface design#m
#mMove screen objects or the window#m
#mEdit screen objects or the window#m
#mWindow styles#m
#mText#m
#mExample of a common interface#m
#mHandling radio buttons#m
#mChecking radio buttons and check boxes#m
//Design the interface
Here are the steps to create a screen interface:
Position and size the window by dragging on the title bar and frame.
This is an initial approximation which can be redefined later.
Select the style of the window using the Window/Style option.
For each screen object in your interface:
1] Select the screen object from the Objects menu option.
2] Provide the information requested about the screen object.
3] After the screen object is created, point and click the mouse at
the approximate location of the object.
4] Use CTRL HOME to place the object on the closest column and row.
This makes it easier to line objects up with each other and with
text prompts.
5] Use CTRL ARROW to move objects 1 row or column up, down, left or
right. CTRL SHIFT ARROW moves objects .25 of a row or column.
The window size and position can be changed as needed from
Window/Position and Size option on the menu.
When the interface is finished you can generate the code for the
interface by selecting one of the Code options as described in
#mCreate the code#m.
//Create the code
When your interface looks just right you are ready to generate the
code which will create the interface.
The code can be either copied to the Windows clipboard or to a text
file. When you copy the code to the clipboard, you can press ALT F6
to go to the development environment and immediately paste the code
into an edit window.
When you save to a file you can include it into your application by
selecting Edit/Include from the development environment window.
Once you have copied the code into your application, you need to link
it into the structure of the application. This is described in
#mUsing the code#m.
//Using the code
There are two ways that screen objects can pass the user's selection
along to the knowledge base. The object can be directly linked to a
topic which is called when the user responds to the object or, a
reference to the object, called a handle, can be saved in a topic and
then used to retrieve the value of the object.
Examples of each of these techniques are shown in:
#mLinking an object to an event topic#m and
#mRetrieving the value of an object#m
The best technique to use depends on the type of screen object and
whether you want an action to occur immediately or only after a
Continue or an Ok button is selected. Since buttons always cause
actions to occur, they are always linked to an event topic.
Radio buttons are also almost always linked to an event topic because
they are easier to handle this way (See: #mHandling radio buttons#m).
Generally, the values of the other screen objects are retrieved by
referring to the handles unless an object is the only one on the screen.
See: #mExample of a common interface#m
//Linking an object to an event topic
Buttons and radio buttons are the objects most commonly linked to an
event topic. When other objects are the only ones to appear on the
screen, they are also usually linked to an event topic.
To link an object to an event topic, just change the text (* eventTopic *)
in the code created for the topic with the name of the topic to be linked
to the object.
If no specific events are named to trigger the event, the event topic
is called when the default event occurs. The default events are:
button, radio button or check box - the object is selected
list box - double click or ENTER on a list box item
edit line - the edit line loses the focus
edit box - the edit box is closed
scroll bar - the scroll bar is closed
The events that call the event topic can be changed in each object. This
is described in Appendix D of the manual and in the on-line help system.
See also:
#mExample of a common interface#m,
#mHandling radio buttons#m
//Retrieving the value of an object
The most common Windows interface displays a group of screen objects
along with two buttons at the bottom of the screen which either
accept the user input or cancel it. In this type of interface the
handle of each of the screen objects is assigned to a topic and the
values of the objects are retrieved in the topic which is linked to
the Ok button.
To save the handle of a screen object, just assign the value returned
by the command that created the object to a topic. For example, a
line of code generated by DESIGN might be:
check_box (Backups,(*EventTopic*),10,5).
Once this code is pasted into your edit window in the development
environment you can edit it to save the handle:
cb1 is check_box (Backups,(*EventTopic*),10,5).
Now you can find out if the check box is checked (true) or not (false)
by referring to the handle. For example:
if get_check_box (?cb1)
then makeBackups is yes.
Similarly, you use get_text to find the values of edit objects,
get_scroll_bar to get the value of scroll bars and get_list_box to
find the value of list boxes. Since radio buttons come in sets, they
are a bit more complicated and are usually linked to an event topic.
A radio button example is shown in #mHandling radio buttons#m.
//Example of a common interface
A common Windows interface window contains several objects and an Ok
and Cancel button. The example below shows some code generated by
DESIGN to display this type of interface:
This is a long example so you may want to select PRINT from the menu
to print it.
window (,15,2,39.25,17.3,,[popup,thickFrame,
visible,titleBar,showChildren,siblings]).
text ('
Width: Height:
Special: Font:
').
check_box ('Bold',,3,7).
check_box ('Underline',,3,9).
edit_line (,,10,1.8,5).
edit_line (,,29,1.8,5).
list_box (['Roman','Script','Helvetica'],,22,7,12,3).
button ('Ok',,10,12,9).
button ('Cancel',,22,12,9).
Once this code is copied into the knowledge base, it must be linked
into the structure of the knowledge base. Here is an example of how
this code may be edited:
window (,15,2,39.25,17.3,,[popup,thickFrame,
visible,titleBar,showChildren,siblings]).
text ('
Width: Height:
Special: Font:
').
cb1 is check_box ('Bold',,3,7).
cb2 is check_box ('Underline',,3,9).
ed1 is edit_line (,,10,1.8,5).
ed2 is edit_line (,,29,1.8,5).
lb1 is list_box (['Roman','Script','Helvetica'],,22,7,12,3).
button ('Ok',ok,10,12,9).
button ('Cancel',cancel,22,12,9).
topic ok.
if ?cb1
then bold is true
else bold is false.
if ?cb2
then underLine is true
else underline is false.
width is get_text (?ed1).
height is get_text (?ed2).
font is get_list_box (?lb1).
close_window ().
end.
topic Cancel.
close_window ().
end.
For an example using radio buttons see #mHandling radio buttons#m.
//Handling radio buttons
Radio buttons are almost always linked to an event topic because it
greatly simplifies their use. If a group of radio buttons is assigned
an initial value (see #mChecking radio buttons and check boxes#m)
it's important to remember to restore that value if the Cancel button
is selected.
Here's an example which shows the code generated by DESIGN and how
the code is used to create an effective interface. This is a long example
so you may want to select PRINT from the menu to print it.
window ((* eventTopic*),17.71,2,34,15,,[popup,thickFrame,visible,
titleBar,showChildren,siblings]).
text ('
Monitor type:
').
radio_button ([['VGA',13,4],['EGA',13,'5.5'],['CGA',13,'7'],
['Mono',13,'8.5']], (* eventTopic *)).
button ('Ok',(* eventTopic *),8,11,8).
button ('Cancel',(* eventTopic *),20,11,).
Here is the edited code:
window (,17.71,2,34,15,,[popup,thickFrame,visible,
titleBar,showChildren,siblings]).
text ('
Monitor type:
').
radio_button ([['VGA',13,4,t],['EGA',13,'5.5'],['CGA',13,'7'],
['Mono',13,'8.5']], monitorType).
button ('Ok',done,8,11,8).
button ('Cancel',done,20,11,).
topic monitorType (item).
monitorType is ?item.
end.
topic done (item).
if ?item is Cancel
then monitorType is VGA.
close_window ().
end.
When a radio button is selected, the topic monitorType is
called and is passed the name of the radio button selected.
This name is assigned as the value of monitorType. When
either of the buttons is selected, the topic done is called and
is passed the name of the button selected. If the CANCEL
button is selected, monitorType is set to its initial value which
is VGA. Notice in the definitions of the radio buttons that the
value T was assigned to the VGA radio button to select it on
the display.
//Save the interface design
Whenever you create a screen interface which is not complete or may
serve as the basis of another screen, you should save the interface.
This is NOT the same as generating the code.
Once a setup has been saved from either File/Save or File/Save As,
it can be re-loaded and modified.
Remember,
*** If you don't save the setup
you will have to start from scratch ***
//Move screen objects or the window
When an object is created it has the focus. If it does not have the
focus, click on it to make it the current object. To move it just
point and click the mouse at the desired location. To fine tune the
location use CTRL + HOME to move to the nearest whole numbered
column and row. CTRL + ARROW moves the objects one whole row
or column up, down, left or right. CTRL + SHIFT + ARROW moves 1/4
of a row or column up, down, left or right.
Objects can also be moved from Edit/Position on the DESIGN menu.
Windows with title bars can be moved by clicking and dragging on the
titlebar. Windows can also be moved from the Window/Position and
Size options on the DESIGN menu.
//Window styles
When the interface window is first created it is a standard popup
window with a titlebar and a thick frame. Use these to approximately
size and position the window before changing the style.
To change the style select Window/Style from the DESIGN menu. The
styles which are available are those which affect the size of the
display area of the window. You can also include a menu in the
window if your interface will contain a menu.
ADDITIONAL STYLES
If you want to add additional styles such as MaximizeBox, ControlMenu,
and MinimizeBox to your window, they can be added into the code
generated by DESIGN.
CHILD WINDOWS
If the window you create is going to be a child window of another
window you will have to make some changes to the code generated to
create the window.
You will have to change the style from Popup to Child, add the value
of the topic containing the parents handle immediately following the
style and change the position co-ordinates. The position change must
be made because a child's co-ordinates are measured from the upper
left corner of the parent, not the screen.
Here's an example of the changes needed to turn a window code
generated by DESIGN into code for a child window.
DESIGN code:
window (,10,5,20,10,,[PopUp, ThickFrame, TitleBar, Sibling,
ShowChildren]).
Edited code:
w1 is window (,20,3,40,15).
window (,1,1,20,10,,[Child, ThickFrame, TitleBar, Sibling,
ShowChildren],?w1).
Here we created a parent window and saved its handle in the topic w1.
The child is placed at row 1, column 1 of the parent. The style Popup
is changed to Child and the window handle of the parent is provided.
When an interface screen contains a simple child window with no frame
or a thin frame you can create an edit box in the interface to get
the size and position co-ordinates for the child window.
//Text
Text can be typed into the window or copied from a file or the
clipboard. Select the option from Text on the DESIGN menu.
To edit text already on the screen select Text/Type from the menu.
To align edit lines with a line of text, point and click on the edit
line and then press CTRL + HOME.
If your text contains single quotes or # signs which you want to
display, be sure to double them after you paste the code into
your application.
//Checking radio buttons and check boxes
The code created for check boxes and radio buttons does not create any
of those objects with a check no matter how they appear on the screen.
Checks must be added to the code. An object can be checked when it
is created as in these example:
DESIGN code:
check_box ('Send output to the printer',(*EventTopic*),10,3).
radio_button ([EGA,10,8],[VGA,10,10],[MONO,10,12]],(*EventTopic*)).
Edited code:
check_box ('Send output to the printer',(*EventTopic*),10,3,t).
radio_button ([EGA,10,8],[VGA,10,10,t],[MONO,10,12]],MonitorType).
The value t in an object displays a check in the object. An f or no
value leaves the object unchecked.
Objects can also be checked and unchecked using set_radio_button or
set_check_box with the handle of the object as in this example:
set_check_box (?cb1,t).
set_radio_button (element (?rb1,2),t).
Since radio_button returns a list of handles, we must specify which
radio button on the list is checked.
//Edit screen objects or the window
The text and size of screen objects size can be edited from
Edit/Name and Edit/Size on the DESIGN menu.
Window size can be changed by pointing and dragging on a window with
a ThickFrame or selecting Window/Position and Size from the DESIGN
menu. Windows with title bars can be positioned with a point and drag
on the title bar.