home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 2
/
goldfish_vol2_cd1.bin
/
files
/
dev
/
e
/
amiga_e
/
src
/
tools
/
easygui
/
easygui.doc
next >
Wrap
INI File
|
1992-09-02
|
5KB
|
154 lines
[sorry folks, I have been working on this just before the release
deadline, and it's far from finished. blame it on bad timing :-).
Anyway, for the more adventurous amongst you all, go ahead and
try it! but be warned that things will change, and that things
don't work yet as the should (or don't work at all). below are
some bit'n'pieces of documentation I had lying around, and at the
end you will see what's missing...]
Introducing the new:
E A S Y G U I
An interface builder for E, with the following highlights:
- It's totally Font-Sensitive
- It's Resizable
- It's Self-Organising, i.e. it arranges gadgets
- It's more StyleGuide compliant than your granny
- It's Fast and Flexible
- It's relatively small, needs no extra external libraries
- And above all: It's extremely easy to use!!!
EasyGUI takes the form a module file that needs to be included into your
E source. The most simple form of constructing a GUI consist of calling
the function easygui() with a (possibly nested) E list which describes
your GUI. just to show how Easy, try this source:
MODULE 'tools/EasyGUI'
PROC main() IS easygui('um,...',[BUTTON,0,'Ok!'])
This'll open a window with just one gadget in it, and wait for the
user to push it. If easygui() can't get what it wants, it'll start
throwing around exceptions, so we'll probably need an exception
handler to be able to inform the user properly (see below).
The first arg of easygui() is the window title, the second one is the
GUI description. The form of these desciptions is quite simple: It's a
list with as first element the type of gadget, the second is called an
action value (more later), and the rest is gadget-specific.
To be able to build GUI's outof more components than just one gadget,
one can group gadgets with a ROW and a COL list:
[COL,
[BUTTON,1,'Ok'],
[BUTTON,0,'Cancel']
]
This'll create a new group, consisting of two gadgets next to eachother.
COL and ROW groups are like a single gadget, i.e. you can easily put them
into other groups, to create GUI's of infinite complexity.
For example, try this source:
------------------------
sofar for the documentation I was typing. more infos:
groupings:
ROWS,EQROWS,COLS,EQCOLS,BEVEL
gadgets etc.
general format: [NAME,action,text,...]
in {}: which direction it may resize.
* = not implemented or things missing.
[BUTTON,action,intext]
buttonaction(info)
[CHECK,action,righttext,checkedbool,lefttextbool]
checkaction(info,checkedbool)
*[INTEGER,action,lefttext,num]
integeraction(info,newnum) {x}
*[LISTV,action,textabove,xsize,xsize,execlist,readbool,selected] (selected: 0=none, 1=read, 2=strgad)
listviewaction(info,num_selected) {x,y}
[MX,action,righttext,nil_term_elist,lefttextbool]
mxaction(info,num_selected)
*[CYCLE,action,lefttext,nil_term_elist]
cycleaction(info,num_selected)
*[PALETTE,action,lefttext,depth,relx,rely]
paletteaction(info,colour) {x,y}
*[SCROLL,action,isvert,total,top,visible]
scolleraction(info,curtop) {x|y}
*[SLIDE,action,lefttext,isvert,min,max,cur] -> has leveldisplay??
slideraction(info,cur) {x|y}
[STR,action,lefttext,initial,maxchars,relsize]
stringaction(info,newstring) {x}
*[TEXT,text,lefttext,borderbool] {x}
*[NUM,int,lefttext,borderbool] {x}
*[RENDER,actionr,actionp,x,y] -> in fontunits
renderrefresh(x,y,xs,ys)
renderpress(x,y) -> relative to topcorner
*[RENDERFIXED,actionr,actionp,x,y] -> in pixels
renderfixedrefresh(x,y)
renderfixedpress(x,y)
[SBUTTON] {x} -> same as button.
actioncodes:
- an integer in the range 0..999
dogui() will close all and exit with this code
- a ptr to a procedure to perform an action. the type of procedure
(i.e. #of args) differs with each gadget. After calling the procedure,
dogui() will normally continue with this gui, unless the procedure
returns FALSE.
exceptions raised:
"MEM" -- no mem
"GUI" -- for things like CreateGadgetA, OpenWindowTagList etc.
"GT" -- couldn't open gadtools.library
"DF" -- same for diskfont
"Egui" -- a design error: most probably handed over a list to dogui()
that was either to long or too short
<other> -- Raise()ed by own function
example of usage of other three function (= definition easygui())
PROC easygui(windowtitle,gui,info=NIL,screen=NIL,prefs=0,textattr=NIL) HANDLE
DEF gh=NIL:PTR TO guihandle,res=-1
gh:=guiinit(windowtitle,gui,info,screen,prefs,textattr)
WHILE res<0
Wait(gh.sig)
res:=guimessage(gh)
ENDWHILE
EXCEPT DO
cleangui(gh)
IF exception THEN ReThrow()
ENDPROC res
things not done:
- it uses the systemfont instead of the screenfont for now
- doesn't try smaller font if gui doesn't fit
and many smaller probs...