wxerlang workups

Laying out the wx window Part 1

When building the window, think in terms of types of stages of activity:

     1. Start a wx server.
     2. Create a window.
     3. Create and position widgets.
     4. Set up listeners.
 
Let's go!
 
1. Start the server:
    wx:new()
 
2. Create a window.  wx uses the term 'frame' instead of 'window' .
 
    wxFrame:new/4    The parameters are:  Parent, IDInteger, Title (a String), and Options ( a List of Tuples).
 
Let's fill one in.  Give the frame a size of W = 250 and H = 150 (think X,Y like a Cartesian graph).  For ID, just use -1.
 
Server = wx:new(),  %Server will be the parent for the Frame
Frame = wxFrame:new( Server, -1, "Countdown", [{size,{250, 150}}]),
 
We'll stop here.  
 
Let's look at our window. Use wxFrame:show/1.   Here's the code.  Copy paste it into a text editor, and save the file with a .erl extension.
 
-module(wxcd01).
-compile(export_all).
start() -> 
    Server = wx:new(),  %Server will be the parent for the Frame
    Frame = wxFrame:new( Server, -1, "Countdown", [{size,{250, 150}}]), 
    wxFrame:show(Frame).
 
 
Next lesson: we'll add some widgets to our window.  

Main Menu

Login Form