home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
windows
/
kpwdemo.zip
/
DESOBJ.SRC
< prev
next >
Wrap
Text File
|
1990-06-28
|
11KB
|
361 lines
(*================ OBJECT CLASS DESCRIPTION AND METHODS =================== *)
topic Object.
HandleList gets ?handle.
ObjectList gets concat (Object,?Number).
Number is ?Number+1.
current is ?handle.
set_focus (?handle).
topic EventTopic (i,e,h,ins).
if ?e is sys_char_event
then sys_char_event ()
else current is ?h and
(if one_of (['Horizontal Scroll','Vertical Scroll'],?type)
then set_focus (?h) ).
topic sys_char_event.
if ?i is 'CTRL Home'
then column is (?column+0.5) DIV 1and
row is (?row +0.5) DIV 1 and
(if ?type is 'Edit Line' then row is ?row - 0.2) and
move_window (?h,?column,?row)
else ins is element ([ [column,-1],[column,1],[row,1],[row,-1],
[column,-0.25],[column,0.25],[row,0.25],[row,-0.25] ],
where (['CTRL left','CTRL Right','CTRL Down','CTRL Up',
'CTRL SHIFT Left','CTRL SHIFT RIght','CTRL SHIFT Down','CTRL SHIFT Up'],?i)) and
(if ?ins <> []
then first (?ins) is ?first (?ins) + Last (?ins) and
move_window (?h,?column,?row) ).
end.
end. (* EventTopic *)
topic newPosition (item).
item is TwoEdLn ('
Column:
Row: ',?column,?row).
setPosition (first (?item),last (?item)).
end.
topic setPosition (c,r).
move_window (?handle,?c,?r).
column is ?c.
row is ?r.
set_focus (?handle).
end.
topic newSize (item).
item is TwoEdLn ('
Width:
Height: ',?width,?height).
width is first (?item).
height is last (?item).
resize_window (?handle,?width,?height).
end.
end. (* Object *)
(* ======================= END OF OBJECT DESCRIPTION ================== *)
(* %%%%%%%%%%%%%%%%%%%%%% SUB-CLASSES OF OBJECTS %%%%%%%%%%%%%%%%%%%%%% *)
topic &Button.
:name is OneEdLn ('
Name:').
if ?name is '' then name is text.
:width is string_length (?name + 3).
[:handle, :type, :column, :row, :width] is_c [ , Button, 1, 1].
CreateNew ().
im_a (Object).
topic CreateNew.
handle is button (?name,concat (Object,?Number,':EventTopic'),?column,?row,?width,,[select_event,sys_char_event]).
end.
topic MakeCode.
code gets concat ('button (',list_to_string (?name,,,,''''),',(* eventTopic *),',?column,',',?row,',',?width,').').
end.
topic newName.
name is OneEdLn ('
Name:',?name).
set_text (?handle,?name).
if string_length (?name) + 3 > ?width
then width is string_length (?name) + 3 and
resize_window (?handle,?width,2).
end.
topic newSize.
width is OneEdLn ('
Width:',?width).
resize_window (?handle,?width,2).
end.
end. (* Button *)
topic '&Check Box'.
:name is OneEdLn ('
Name:').
if ?name is '' then name is text.
[ :handle, :type, :column, :row] is_c [ , 'Check Box', 1, 1] .
CreateNew ().
im_a (Object).
topic CreateNew.
handle is check_box (?name,concat (Object,?Number,':EventTopic'),?column,?row,,[select_event,sys_char_event]).
end.
topic MakeCode.
code gets concat ('check_box (',list_to_string (?name,,,,''''),',(* eventTopic *),',?column,',',?row,').').
end.
topic newName.
name is OneEdLn ('
Name:',?name).
set_text (?handle,?name).
width is string_length (?name) + 3 and
resize_window (?handle,?width,1.1).
end.
topic newSize.
message ( '
The size of check boxes
cannot be changed.
').
end.
end. (* check box *)
topic '&Radio Button' .
[ :name, :width, :radioList, :handle, :column, :row, :orient, :space, : type] is_c
[ , , , , 1, 1, vertical, 1.5, 'Radio Button'].
getSetup (,vertical,1.5).
CreateNew (?Number).
im_a (Object).
topic getSetup (n,o,s,ed1,ed2,v,h).
window (,40,13,40,13,,[Popupwindow,TitleBar]).
text ('
Names:#x20Orientation:
#x20Spacing:').
ed1 is edit_box (?n,,3,3.5,15,5).
if ?o is vertical then v is t and h is false
else v is f and h is true.
radio_button ([[Vertical,22,3.5,?v],[Horizontal,22,5,?h]],orient).
ed2 is edit_line (?s,,30,6.8,6).
button (Continue,continue,17,9.5).
show_window ().
set_focus (?ed1).
wait ().
name is replace (get_text (?ed1),'',,100).
if ?name is ''
then name is [radio1,radio2,radio3].
space is get_text (?ed2).
hide_window ().
close_window ().
MakeList (?name,1,1).
end. (* setup radio buttons *)
topic MakeList (n,c,r).
radioList is [].
while ?n <> []
then radioList gets [[first (?n),?c,?r]] and
(if ?orient is vertical then r is string_copy (?r+?space,1,5) else c is string_copy (?c+3+string_length (first (?n))+?space,1,5)) and
n is rest (?n).
if ?orient is vertical
then width is last (numeric_sort (string_length (?name)))+4
else width is ?c-?space.
end.
topic orient (item).
orient is ?item.
end.
topic CreateNew (N,lastbutton).
lastButton is last (?radioList).
handle is window (concat (Object,?N,':EventTopic'),?column,?row,?width,last (?lastButton) + 1,,
[child,showChildren,Siblings,visible],?WindowHandle,,,[sys_char_event,get_focus_event]).
radio_button (?radioList,concat (Object,?N,':RadioEvent'),[select_event,get_focus_event,sys_char_event,char_event]).
set_display_window (?WindowHandle).
end.
topic RadioEvent (i,e).
RadioEvent is t.
EventTopic (?i,?e,?handle).
end.
topic MakeCode (n,c,r).
[n,c,r] is_c [?name,?column,?row].
rList is [].
while ?n <> []
then rList gets [[first (?n),?c,?r]] and
(if ?orient is vertical then r is string_copy (?r+?space,1,5) else c is string_copy (?c+3+string_length (first (?n))+?space,1,5)) and
n is rest (?n).
if ?orient is vertical
then w is last (numeric_sort (string_length (?name)))+3
else w is ?c-?space.
code gets concat ('radio_button (',list_to_string (?rList,',','[',']',''''),', (* eventTopic *)).').
end.
topic newName.
newSize ().
end.
topic newSize (oldHandle).
getSetup (?name,?orient,?space).
oldHandle is ?handle.
close_window (?handle).
CreateNew (where (?handleList,?oldHandle)).
handleList is replace (?HandleList,?oldHandle,?Handle).
current is ?handle.
end.
end. (* radio button *)
topic '&Edit Line'.
:width is OneEdLn ('
Width:',12).
[ :handle, :type, :name, :column, :row] is_c [ , 'Edit Line', , 1, 1.5].
CreateNew ().
im_a (Object).
topic CreateNew.
handle is edit_line (?name,concat (Object,?Number,':EventTopic'),
?column,?row,?width,[get_focus_event,sys_char_event]).
end.
topic MakeCode.
code gets concat ('edit_line (',list_to_string (?name,,,,''''),',(* eventTopic *),',?column,',',?row,',',?width,').').
end.
topic newName.
name is OneEdLn ('
Text:').
set_text (?handle,?name).
end.
topic newSize.
width is OneEdLn ('
Width:',?width).
resize_window (?handle,?width,1.5).
end.
end. (* Edit Line *)
topic 'Edit Bo&x' (item).
item is TwoEdLn ('
Width:
Height:',12,5).
:width is first (?item).
:height is last (?item).
[:handle, :type, :name, :column, :row] is_c [ , 'Edit Box', , 1, 1].
CreateNew ().
im_a (Object).
topic CreateNew.
handle is edit_box (?name,concat (Object,?Number,':EventTopic'),?column,?row,?width,?height,,
[get_focus_event,sys_char_event]).
end.
topic MakeCode.
code gets concat ('edit_box (',list_to_string (?name,,,,''''),',(* eventTopic *),',?column,',',?row,',',?width,',',?height,').').
end.
topic newName.
name is OneEdBx ('
Text:',?name).
set_text (?handle,?name).
end.
end. (* Edit Box *)
topic '&List Box'.
:name is OneEdBx ('
Items:').
if ?name is ''
then name is [item1,item2,item3,item4]
else name is replace (?name,'',,100).
:width is last (numeric_sort (string_length (?name)))+3.
:height is list_length (?name).
[ :handle, :type, :column, :row] is_c [ , 'List Box', 1, 1].
CreateNew ().
im_a (Object).
topic CreateNew.
handle is list_box (?name,concat (Object,?Number,':EventTopic'),?column,?row,?width,?height,,,
[get_focus_event,sys_char_event]).
end.
topic MakeCode.
code gets concat ('list_box (',list_to_string (?name,',','[',']',''''),',(* eventTopic *),',?column,',',?row,',',?width,',',?height,').').
end.
topic newName.
name is OneEdBx ('
Items:',?name).
set_text (?handle,?name).
if list_length (?name) < ?height
then height = list_length (?name) and
resize_window (?handle,?width,?height).
end.
end. (* list box *)
topic '&Horizontal Scroll Bar'.
:width is OneEdLn ('
Width:',15).
[ :handle, :type, :name, :column, :row, :height] is_c [ , 'Horz Scroll Bar', , 1, 1, 1].
CreateNew ().
im_a (Object).
topic CreateNew.
handle is horz_scroll_bar (concat (Object,?Number,':EventTopic'),?column,?row,?width,?height,,,[get_focus_event,sys_char_event,scroll_event]).
end.
topic MakeCode.
code gets concat ('horz_scroll_bar ((* eventTopic *),',?column,',',?row,',',?width,',',?height,',0,100).').
end.
topic newName.
message ( '
There is no name on
scroll bars. ').
end.
end. (* horz scroll *)
topic '&Vertical Scroll Bar'.
:height is OneEdLn ('
Height:',7).
[ :handle, :type, :name, :column, :row, :width] is_c [ ,'Vert Scroll Bar', , 1,1, 2].
CreateNew ().
im_a (Object).
topic CreateNew.
handle is vert_scroll_bar (concat (Object,?Number,':EventTopic'),?column,?row,?width,?height,,,[sys_char_event,scroll_event,get_focus_event]).
end.
topic MakeCode.
code gets concat ('vert_scroll_bar ((* eventTopic *),',?column,',',?row,',',?width,',',?height,',0,100).').
end.
topic newName.
message ( '
There is no name on
scroll bars. ').
end.
end. (* vertical scroll *)
(* %%%%%%%%%%%%%%%%%%%%%% END OF SUB-CLASSES %%%%%%%%%%%%%%%%%%%%%%%%%% *)