Code - Win32Lib
Our sample window as it looks using Win32Lib:
Derek Parnell, the maintainer of Win32Lib, supplied the following Win32Lib code for our sample program:
include win32lib.ew
without warning
global function main(sequence pArgs)
createForm( {
-- Initial 'Scramble Me' form
"Window, name=scramWin, caption=Scramble Me"
,
"Label, caption=Enter your name:, at=(8,8)"
,
"EditText, name=editName,"
& "at=(**, *+0)," -- left=same as previous, top=previous bottom
& "width=224"
,
"Button, Scramble Me,"
& "at=(**, *+4)," -- left=same as previous, top=previous bottom + 4
& "width=88"
,
"Button, Quit,"
& "at=(editName-88, **)," -- left=previous right - 88, top=previous top
& "width=88,"
} )
return 0
end function
include w32start.ew
For Win32Lib, I prefer the method above because it's very versatile. Win32Lib can read form definitions from an external text file. The other GUI libraries could have this functionality, but you'd have to build a parser. With Win32Lib, it's built-in.
Win32Lib also allows this "old school" method of coding (code provided by Brian Broker):
without warning
include Win32Lib.ew
constant
scramWin = create(Window,"Scramble Me",0,Default,Default,252,128,0),
lblEnter = create(LText,"Enter your name:",scramWin,8,8,92,20,0),
editName = create(EditText,"",scramWin,8,32,224,24,0),
btnScram = create(PushButton,"Scramble Me",scramWin,8,64,88,28,0),
btnQuit = create(PushButton,"Quit",scramWin,144,64,88,28,w32AUTOCLOSE)
WinMain(scramWin,Normal)