home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
windows
/
kpwdemo.zip
/
DESIGNDE.SRC
< prev
next >
Wrap
Text File
|
1990-06-28
|
13KB
|
418 lines
@desobj.src
collect_not_ok ().
introWin is window (,26,8,34,15,,[popup,visible,DialogFrame]).
set_text (,'
#x5KnowledgePro (Windows)
#x9Design Program
#x2⌐ Knowledge Garden Inc. 1990').
if element (system_info (), 3) < 8
then logo is load_icon ('kpwin.ico') and
icon (?logo, 14,12)
else logo is [].
(* ======== Create the menu window ================ *)
MenuTopic:saveCode is [].
MenuTopic:saveSetup is [].
wMenu is window (menuTopic:E&xit,30,23,55,4,Design,[OverlappedWindow], , , ,close_event).
m1 is menu ([[&File,&New,'&Load...','&Save','Save &As...',,E&xit],
[&Window,&Style,'&Position and Size'],
[&Objects,&Button,'&Check Box','&Radio Button','&Edit Line','Edit Bo&x',
'&List Box','&Horizontal Scroll Bar','&Vertical Scroll Bar'],
[&Text,'&Type in Text','from &Clipboard','from &File'],
[&Edit,&Position,&Size,&Name,&Delete],
[Co&de,'to &Clipboard','to &File'],&Help],menuTopic).
close_window (?introWin).
if ?logo <> [] then delete_icon (?logo).
CreateWindow ().
show_window (?wMenu).
topic CreateWindow.
[Number,objectList,winColumn,winRow,winWidth,winHeight,
winText,winMenu,menuCreate,handleList] is_c [1,,15,2,50,15,,no,no].
winStyle is [popup,thickFrame,visible,titleBar,showChildren,siblings].
windowHandle is window (WindowEventTopic,15,2,50,15,,
[popup,thickFrame,titleBar,showChildren,siblings,visible],,,,
[move_event,resize_event,close_event]).
current is ?windowHandle.
hyper_region ( ClickMove,1,1,200,100).
end.
(* <<-<<-<<-<<-<<-<<-<<-<<-<<-<<- MENU OPTIONS -<<-<<-<<-<<-<<-<<-<<<< *)
topic menuTopic (item).
if one_of ([&Button,'&Check Box','&Radio Button','&Edit Line',
'Edit Bo&x','&List Box','&Horizontal Scroll Bar','&Vertical Scroll Bar'],?item)
then new (concat (!main:Object,?Number),?item)
else do (?item).
collect ().
topic &New.
close_window (?windowHandle).
if ?objectList <> []
then remove_topic ( ?objectList ).
handleList is [].
createWindow ().
end.
topic '&Load...' (file,temp,item).
file is file_menu ('*.set').
if ?file is [] then exit ().
close_window (?windowHandle).
if ?objectList <> []
then remove_topic (?objectList).
remove_topic ([winColumn,winRow,winWidth,winHeight,winText,winStyle,winMenu,objectList]).
load (?file,'!main').
saveSetup is ?file.
windowHandle is window (WindowEventTopic,?winColumn,?winRow,?winWidth,?winHeight,,?winStyle,,,,[move_event,resize_event,close_event]).
if ?WinMenu is yes
then menuCreate is yes and
menu ([Sample,Menu],Number).
menuCreate is no.
text (?winText).
number is 1.
handleList is [].
if ?objectList <> [] then createObjects (?objectList).
if ?handleList is [] then current is ?windowHandle.
hyper_region ( ClickMove,1,1,200,100).
end.
topic '&Save'.
if ?saveSetup is []
then 'Save &As...'()
else (if exists (objectList)
then save_topic (?saveSetup, combine (?objectList,objectList,winColumn,
winRow,winWidth,winHeight,winText,WinMenu,winStyle))
else save_topic (?SaveSetup,[winColumn,winRow,winWidth,winHeight,winText,WinMenu,winStyle])).
end.
topic 'Save &As...'.
SaveSetup is save_as (?saveSetup,'Save design to file name:').
if ?saveSetup <> []
then (if string_where (?saveSetup,'.') = 0
then saveSetup is concat (?saveSetup,'.SET')) and
(if exists (objectList)
then save_topic (?saveSetup, combine (?objectList,objectList,winColumn,
winRow,winWidth,winHeight,winText,WinMenu,winStyle))
else save_topic (?SaveSetup,[winColumn,winRow,winWidth,winHeight,winText,WinMenu,winStyle])).
end.
topic E&xit.
new_kb ('demo.ckb').
end.
topic '&Position and Size' (ed1,ed2,ed3,ed4).
window (,50,16,20,15,,[popupWindow,TitleBar]).
text ( '
Column:
Row:
Width:
Height: ').
ed1 is edit_line (?winColumn,,11,1.8,6).
ed2 is edit_line (?winRow,,11,3.8,6).
ed3 is edit_line (?winWidth,,11,5.8,6).
ed4 is edit_line (?winHeight,,11,7.8,6).
button ('Continue',continue,5,10.5,11).
show_window ().
set_focus (?ed1).
wait ().
[winColumn,winRow,winWidth,winHeight] is_c get_text ([?ed1,?ed2,?ed3,?ed4]).
close_window ().
move_window (,?winColumn,?winRow).
resize_window (,?winWidth,?winHeight).
end.
topic &Style.
hide_window (?wMenu).
frame is thickFrame.
winStyle is [popup,visible,showChildren,siblings].
window (,26,8,34,15,'Create Window',[popupWindow,ControlMenu,TitleBar]).
text('
Add Elements: Frame:').
:c1 is check_box ('TitleBar',correct,4,3.5,t).
:c2 is check_box ('HorzScroll',correct,4,5).
:c3 is check_box ('VertScroll',correct,4,6.5).
:c4 is check_box ('Menu Bar',correct,4,8).
:rb1 is radio_button ( [[Thin,21,3.5],[Thick,21,5,t],[Dialog,21,6.5]],Frame).
:b1 is button (Continue,newStyle,4,10.5).
button (Cancel,cancel,19,10.5,12).
show_window ().
set_focus (?b1).
topic cancel.
close_window ().
show_window (?wmenu).
end.
topic NewStyle.
if get_check_box (?c1) then winStyle gets TitleBar.
if get_check_box (?c2) then winStyle gets HorzScroll.
if get_check_box (?c3) then winStyle gets VertScroll.
if get_check_box (?c4)
then winMenu is yes
else winMenu is no.
winStyle gets ?frame.
close_window ().
close_window (?windowHandle).
windowHandle is window (WindowEventTopic,?winColumn,?winRow,?winWidth,
?winHeight,,?winStyle,,,,[move_event,resize_event,close_event]).
current is ?windowHandle.
if ?WinMenu is yes
then menuCreate is yes and
menu ([Sample,Menu],Number).
menuCreate is no.
text (?winText).
if ?objectList <> [] then createObjects (?objectList).
hyper_region ( ClickMove,1,1,200,100).
show_window (?wMenu).
end. (* newStyle *)
topic correct (item,e,h).
if not (get_check_box (?h))
and get_radio_button ( last (?rb1) )
then set_radio_button ( element (?rb1,2),t) and
set_radio_button (last (?rb1),f) and
frame is ThickFrame.
end.
topic Frame (i).
Frame is concat (?i,Frame).
if ?i is Dialog then set_check_box ([?c1,?c2,?c3,?c4],f).
end.
end. (* &Style *)
topic 'from &Clipboard'.
WinText gets first (read_clipboard ()).
set_text (?WindowHandle,?WinText).
end.
topic 'from &File' (file).
file is file_menu ('*.txt').
if ?file is [] then exit ().
winText gets read (?file).
set_text (?WindowHandle,?WinText).
end.
topic '&Type in Text' (w, edwin).
hide_window (?wMenu).
w is window (,58,26,22,3,,[popup,visible,ShowChildren],,,blue).
button ('Done Entering Text',Continue,2,1.5).
edWin is edit_window (?winText,,1,1,100,100,,
[childwindow,visible,siblings,showChildren],?WindowHandle).
wait ().
winText is get_text (?edWin).
set_text (?WindowHandle,?winText).
close_window ([?edWin,?w]).
show_window (?wMenu).
hyper_region ( ClickMove,1,1,200,100).
set_focus (?current).
end. (* type text *)
topic &Position.
if ?current <> ?windowHandle then do (concat (CurrentObject (),':newPosition')).
end.
topic &Size.
if ?current <> ?windowHandle then do (concat (currentObject(),':newSize')).
end.
topic &Name.
if ?current <> ?windowHandle then do (concat (currentObject (),':newName')).
end.
topic &Delete.
close_window (?current).
ObjectList is remove (?ObjectList, CurrentObject ()).
handleList is remove (?handleList,?current).
current is last (?handleList).
if ?current is []
then current is ?WindowHandle.
end. (* delete *)
topic 'to &File'.
SaveCode is save_as (?SaveCode).
if ?saveCode is [] then exit ().
new_file (?saveCode).
CreateCode ().
write (?SaveCode,?code).
code is [].
end.
topic 'to &Clipboard'.
Createcode ().
text_to_clipboard (?code).
showCode ().
code is [].
topic showCode .
:temp is window (,9.142,2,74,15,,[popup,titlebar,showChildren,siblings,thickframe,vertscroll,horzscroll]).
menu ( [Done],done).
text ('
The code shown below has been copied to your clipboard:
',?code).
make_modal ().
show_window ().
topic done.
close_window (?temp).
end.
end. (* showCode *)
end.
topic CreateCode (temp,item,text1,text2,tempStyle).
window ((* eventTopic*),33.85,8.25,29.57,10.37,,[popup,visible,showChildren,siblings,DialogFrame]).
set_text (,'
One moment while the
code is created .... ').
code is [].
tempStyle is remove (?winStyle,visible).
code gets concat ('window ((* eventTopic*),',?winColumn,',',?winRow,',',?winWidth,',',?winHeight,',,',list_to_string (?tempStyle,',','[',']'),').').
if ?WinMenu is yes then code gets 'menu ([Sample,Menu]).'.
if ?WinText <> []
then :text1 is concat ('text (''',first (?WinText) ) and
:text2 is rest (?WinText) and
code gets ?text1 and
code gets ?text2 and
code gets ' '').'.
temp is ?ObjectList.
while ?temp <> []
then item is first (?temp) and
do (concat (?item,':MakeCode')) and
temp is rest (?temp).
code gets ('show_window ().').
close_window ().
end.
topic &Help.
load ('apphelp.hkb',temp).
temp:file is 'design.hyp'.
temp ().
wait ().
remove_topic (temp).
collect ().
end.
end. (* menuTopic *)
(* <<-<<-<<-<<-<<-<<-<<-<<- END OF MENU OPTIONS <<-<<-<<-<<-<<-<<-<<-<<- *)
(* ########## TOPIC CALLED BY HYPER-REGIONS AND WINDOW EVENTS ###### *)
topic ClickMove (n,h,c,r).
(* This topic is called when the mouse is clicked in the window.
It moves the current object to the location of the click. *)
if ?current is ?windowHandle then exit ().
c is string_copy (?c,1,5).
r is string_copy (?r,1,5).
do (concat (CurrentObject () ,':setPosition'),?c,?r).
end.
topic WindowEventTopic (i,e).
if ?menuCreate is no
then do (?e).
topic move_event (c,r).
winColumn is string_copy (first (?i),1,5).
winRow is string_copy (element (?i,2),1,5).
end.
topic resize_event (w,h).
winWidth is string_copy (element ( window_info (),3),1,5).
winHeight is string_copy (element ( window_info (),4),1,5).
end.
topic close_event.
windowHandle is [].
end.
end. (* WindoweventTopic *)
(* ################ END OF EVENT AND HYPER-REGION TOPICS ############### *)
(* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TOPICS USED TO READ IN VALUES ^^^^^^^^^^^^^^^^^^^^^^^^^^ *)
topic message (m).
window (,53,18,28,10,,[popupWindow,Visible,TitleBar,thickFrame]).
text (?m).
button ('Continue',continue,9,5.5,11).
wait ().
close_window ().
end.
topic oneEdLn (txt,d1,ed).
window (,53,18,22,10,,[popupWindow,TitleBar]).
text (?txt).
ed is edit_line (?d1,,11,1.8,8).
button ('Continue',continue,6,6.5,11).
show_window ().
set_focus (?ed).
wait ().
oneEdLn is get_text (?ed).
close_window ().
end.
topic oneEdBx (txt,d1,ed).
window (,53,16,24,14.5,,[popupWindow,TitleBar]).
text (?txt).
ed is edit_box (?d1,,4,4,18,5).
button ('Continue',continue,7,10.5,11).
show_window ().
set_focus (?ed).
wait ().
oneEdBx is get_text (?ed).
close_window ().
end.
topic twoEdLn (txt,d1,d2,ed1,ed2).
window (,53,18,22,10,,[popupWindow,TitleBar]).
text (?txt).
ed1 is edit_line (?d1,,11,1.8,8).
ed2 is edit_line (?d2,,11,3.8,8).
button ('Continue',continue,6,6.5,11).
show_window ().
set_focus (?ed1).
wait ().
twoEdLn is [get_text (?ed1), get_text (?ed2) ] .
close_window ().
end.
(* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ *)
topic CurrentObject .
(* This topic finds the topic name of the topic that is associated
with the current object *)
CurrentObject is element (?ObjectList, where (?HandleList,?current)).
if ?CurrentObject is []
then current is parent_window (?current).
end.
topic CreateObjects (temp).
number is 1.
handleList is [].
while ?temp <> []
then item is first (?temp) and
do (concat (?item,':CreateNew'),?number ) and
handleList gets ? (concat (?item,':handle') ) and
number is ?number + 1 and
temp is rest (?temp).
if ?handleList <> []
then current is last (?handleList).
end.