home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 2
/
amigaformatcd02.iso
/
pd
/
text
/
alphaspell_suite
/
varexx
/
demo
/
demo.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-05-20
|
8KB
|
285 lines
/* Demo Script */
guifile = 'test.gui'
options results
launchvarexx = FALSE
/* Open libs needed */
if ~show("L","rexxsupport.library") then
if ~addlib("rexxsupport.library", 0, -30) then exit
if ~show("L","rexxreqtools.library") then
if ~addlib("rexxreqtools.library", 0, -30) then exit
/* Check Varexx is loaded if not load it */
if show( 'p', 'VAREXX' ) ~= 1 then do
address command 'run varexx'
waitforport VAREXX
launchvarexx = TRUE
end
address VAREXX
'version'
if result = '' then result = 0
if result < 1.7 then do
call message('This demo needs v1.7 of Varexx or greater.')
exit
end
/* Open the port for gui to talk to */
call openport("WINDOWPORT")
/* Load the gui file into varexx */
'load 'guifile' WINDOWPORT'
/* Set host to the port for this gui file */
host = result
address value host
/* Display the window */
show
busy set
call message('Varexx opens Gadtoolsbox Gui files and can set the busy pointer.')
call message('The multiple choice options can be set.')
setnum one 2
do n = 1 to 3
setnum cycle n
call delay(15)
end
setnum cycle 0
call message('The text in cycle gadgets may be changed.')
setlabel 'label=cycle' 'cycle' 'Well' 'I' 'am' 'very' 'impressed' 'with' 'this' 'all'
call delay(15)
do n = 1 to 7
setnum cycle n
call delay(15)
end
setnum cycle 0
call message('The sliders and scrollers can be moved.')
setnum scroll 10
setnum slider 10
call message('And their other values altered.')
setbar scroll min 50 max 150
setbar slider min 0 max 100
call message('Fixed text and number gadget can be filled.')
settext text 'Amiga'
setnum noview 4000
call message('as can the editable ones.')
settext gad1 'You could change this.'
setnum num 2001
call message('Checking check boxes.')
setcheck gad2 check
call message('Add items to listviews.')
'setlist LIST Haddock Cod Place Skate Herring Tuna'
call message('Opps. You can get rid of them as well')
'setlist LIST Place del'
call message('and select them.')
'setlist LIST select Cod'
call message('Clear the list and start again.')
s.1 = 'Monday'
s.2 = 'Tuesday'
s.3 = 'Wednesday'
s.4 = 'Thursday'
s.5 = 'Friday'
s.count = 5
'setlist LIST clear stem='s
call message('Disable gadgets')
set slider cycle scroll gad1 gad2 num okay list one file palette disable
call message('and guess what -- Enable them too.')
set slider cycle scroll gad1 gad2 num okay list one file palette enable
call message('You can change the screen and window titles.')
setlabel project0 '"' || 'New Window Title' || '"' window
setlabel project0 '"' || 'New Screen Title' || '"' screen
call message('You can move windows about.')
'window x =0 y = 0'
'readcords temp'
fish = 'Click Onwards and play with the GUI and watch the shell' || '0A'x
fish = fish || 'Try keyboard shortcuts and the rest of the keyboard.' || '0a'x
fish = fish || ' Click Okay to continue.'
call message( fish )
'window x ='temp.x 'y = 'temp.y
busy
do forever
call waitpkt( "WINDOWPORT" )
packet = getpkt( "WINDOWPORT" )
if packet ~= '00000000'x then do
class = getarg(packet)
type = word( class, 1)
msg = word( class, 2 )
select
when type = closewindow then say 'Clicked on close gadget.'
when type = okay then leave
when type = list then say 'List selected 'msg
when type = cycle then say 'Cycle gadget option 'msg
when type = one then say 'Multiple Choice gadget option 'msg
when type = scroll then say 'Scroller now at 'msg
when type = slider then say 'Slider now at 'msg
when type = gad1 then say 'You typed in 'msg
when type = num then say 'Your number is 'msg
when type = palette then say 'Colour #'msg
when type = gad2 then say 'Check is 'msg
when type = keyboard then do
select
when msg = down then do
'read list number'
n = result
if n = 'RESULT' then n = 1
else
n = n + 1
if n > s.count then n = s.count
setlist list select s.n
end
when msg = up then do
'read list number'
n = result
if n = 'RESULT' then n = 2
n = n - 1
if n < 1 then n = 1
setlist list select s.n
end
otherwise say 'Keyboard 'msg
end
end
when type = gad2 then say 'Check is 'msg
when type = file then do
dict = rtfilerequest(, ,'Select a file' , , 'rt_reqpos = reqpos_centerscr')
settext gad1 dict
end
otherwise say class
end
end
end
call message( ' Lets us proceed. Try the Zoom Gadget...' )
window zip
fish = 'That was Pos zoom. Varexx supports most' || '0a'x
fish = fish || 'of the options that can be set in GadToolsBox.' || '0a'x
fish = fish || 'Varexx adapts to fonts and resolutions.'
call message( fish )
busy set
call message( 'Your arexx script can read from Varexx Gadgets.')
read one
fish = 'Multiple Choice option = 'result || '0a'x
read cycle
fish = fish || 'Cycle gadget option = 'result || '0a'x
read slider
fish = fish || 'Slider at 'result || '0a'x
read scroll
fish = fish || 'Scroller at 'result
call message( fish )
read gad1
fish = 'You typed : 'result || '0a'x
read num
fish = fish || 'Number entered : 'result || '0a'x
read palette
fish = fish || 'Palette colour : 'result || '0a'x
read gad2
fish = fish || 'Check is 'result
call message( fish )
read list
if result = 'RESULT' then do
call message( 'No item is selected in the list. But you can...')
end; else; do
call message( 'For lists the selected item is 'result' or...')
end
read list var h
fish = 'List all items...'
do n = 1 to h.count
fish = fish || '0a'x || h.n
end
drop h
call message( fish )
'hide'
call message( 'Windows can be hidden')
'show next'
call message( 'and if there is more than one in a GUI file.' )
/* Create the context for a new window */
'spawn WINDOWPORT'
vhost2 = RESULT
address value vhost2
/* Change the text of the window */
setlabel okay 'Fish'
setlabel list 'Fish'
setlabel 'label=cycle' 'Fish'
setlabel one 'Fish' 'Fish' 'Fish'
setlabel scroll 'Fish'
setlabel slider 'Fish'
setlabel gad1 'Fish'
setlabel num 'Fish'
setlabel palette 'Fish'
setlabel gad2 'Fish'
setlabel 'label=text' 'Fish'
setlabel noview 'Fish'
/* Show the second window */
'show'
address
/* Move the other forwards */
'window front'
call message( 'Both on screen at once !' )
fish = 'And the text in the windows has changed' || '0A'x
fish = fish || 'useful when used with the locale library.' || '0a'x
fish = fish || 'if not here....'
'hide unload'
address
call message( fish )
/* Unload and remove both windows */
'hide unload'
call message('That is all. I Hope you liked it.')
call closeport( "WINDOWPORT" )
if launchvarexx = TRUE then address command vxc
exit
message : procedure
call rtezrequest( arg(1),'Onwards','Varexx (Patronizing) Demo','rt_reqpos = reqpos_topleftscr rtez_flags=ezreqf_centertext',)
return