-- HelloWorld.exw ---------------------------------------------------------
-- This program creates a window and displays the words "Hello World!" on
-- it when you press a button.
-- ------------------------------------------------------------------------
include EuWinGUI.ew -- includes the library for EuWinGUI
-- Declare handles for the program's Window controls
-- Notice that the handle of the main Window is not here; EuWinGUI.ew
-- has a global variable named WinHwnd which will automatically be the
-- handle of the main Window.
atom ShowTextButton, GreetingText
procedure EventLoop()
-- This is the event loop; there are only two events that are of
-- significance to us in this program:
-- 1. If the user left-clicks (Click) on the ShowTextButton, we must
-- display the GreetingText.
-- 2. If the user clicks on the Close [X] control at the top right of
-- the main window (WinHwnd), we must get out of the endless loop
-- and go back to the calling procedure, Main().
while True do -- start of "endless loop"
WaitEvent() -- hangs here until user does something
if Event = Click then -- Was it a click? If it was
if EventOwner = ShowTextButton then -- was it on this button?
SetVisible(GreetingText,True) -- if so, display msg.
end if
end if
if Event = Close then -- Was it a close event?
if EventOwner = WinHwnd then -- was it from main window?
return -- if it was, get out.
end if
end if
-- there are lots of other sorts of events we could test for, but
-- they are not relevant to this program.
end while
end procedure -- EventOwner
procedure Main()
-- This is the "Main" procedure
CloseEventEnabled = True -- Enable "Close" events
--Create window and its controls
WindowType = NoMaxWin
ShowFlag = False
-- Create the main window
Window("HW2",1,1,200,100)
ShowFlag = True
-- create the "controls" that will appear on the main window
ShowTextButton = Control(Button, "See Text",50,100-60,80,25)
GreetingText = Control(Text, "HELLO WORLD!",50,20,90,25)
SetVisible(WinHwnd,True) -- make main window visible
SetVisible(GreetingText,False) -- make "Hello World!" invisible
EventLoop() -- run the Event Loop
CloseApp(0) -- program run is over, close normally
end procedure -- Main
Main()
-- End of program text -----------------------------------------------------
Conversion to HTML by PC2HTM.EXE