wxerlang workups

Readying the erlang code

The first thing to do is think about where the erlang code interfaces with the window.   I've made notes in the code to document the places where changes will be needed.  I've also given the module a new name, so if it gets messed up, I can rework it from the prior version.
 
-module(countdown2).
-export([start/0]).
 
start() ->
    ok. % stub
    %% start/0 will generate the window making process, then go into a loop.
    %% cntdwn/1 will be triggered when a button is pressed
    %% cntdwn(10).
 
cntdwn(N) when N > 0 ->  %N will come from the window
    %% it is a good idea to have the output go
    %% both to the shell and the window during testing
    %% put the io:format/2 statement first, in case the window fails to handle it
    io:format("~w~n", [N]),
    %% send N to the window
    receive
        after 1000 -> 
               true
    end,
    cntdwn(N-1);
cntdwn(_) ->
    io:format("ZERO~n"),  % change period to comma
    %% send "ZERO" to the window
    ok.
          

Main Menu

Login Form