Re: little graphic user interfaces - how to program on WinXP system

new topic     » goto parent     » topic index » view thread      » older message » newer message

For this you should see Starting Euphoria Gui Programming. There are several options available. The easiest library to get started with is Win32Lib.

You can download Win32Lib from this link: http://sourceforge.net/projects/win32libex/

Extract the zip file into a new folder named "Win32Lib" in your Euphoria folder (typically that's C:\Euphoria).

Edit your eu.cfg and add the path to the Win32Lib "Include" folder.

[all] 
-d E32 
-eudir C:\Euphoria 
-i C:\Euphoria\include 
-i C:\Euphoria\Win32Lib\Include  # add this line 

Here is a simple Win32Lib example. Save this as demo.exw and run with euiw.exe.

include Win32Lib.ew 
 
-- create a simple window 
constant myWindow = create( 
    Window,  -- control type (a standard Window) 
    "Demo",  -- caption of this Window (title bar text) 
    0,       -- parent of this Window (0 = no parent) 
    Default, -- initial x position (Default = let Windows choose) 
    Default, -- initial y position (Default = let Windows choose) 
    320,     -- initial width 
    240,     -- initial height 
    0 )      -- additional styles (0 = default) 
 
-- create a simple text label 
constant myLabel = create( 
    LText,    -- control type (LText means "left-aligned text") 
    "Hello!", -- caption of this LText (the value displayed on the label) 
    myWindow, -- parent of this control (our 'myWindow' from above) 
    10,       -- initial x position 
    10,       -- initial y position 
    200,      -- initial width 
    20,       -- initial height 
    0 )       -- additional styles (0 = default) 
 
-- create a simple push button 
constant myButton = create( 
    PushButton, -- control type (a standard button) 
    "Click Me", -- caption of this button 
    myWindow,   -- parent of this control 
    10,         -- initial x position 
    40,         -- initial y position 
    90,         -- initial width 
    30,         -- initial height 
    0 )         -- additional styles (0 = default) 
 
-- change the font of the LText control 
setFont( myLabel, "MS Sans Serif", 12, Bold ) 
 
-- create an event handler for the button's "Click" event 
-- 
--   Note: these parameters are standard to all event handlers. 
--   see the documentation for the values contained in 'params' 
--   which is specific to each event. 
-- 
procedure myButton_OnClick( integer self, integer event, sequence params )  
     
    -- show a message box when the user clicks the button 
    message_box( 
        "You clicked the button!", -- the message to display 
        "Clicked!",                -- the caption for the message box 
        MB_OK+MB_ICONINFORMATION ) -- the style of the box (buttons, icons, etc.) 
     
end procedure 
 
-- assign the event handler to the button 
setHandler( 
    myButton,                      -- the control whose events we want to handle 
    w32HClick,                     -- the event of the control we want to handle 
    routine_id("myButton_OnClick") -- the routine we want to handle the events 
) 
 
-- start the application by opening 'myWindow' in 'Normal' mode, 
--   other options include 'Maximized' or 'Minimized' 
WinMain( myWindow, Normal ) 

Hope this helps,

-Greg

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu