Erlang/gs progress

I solved most of my problems with listboxes and grids. I should probably add a couple of other elements, like the editor [aka EditField]. But now is the time to turn to linking the existing elements to events inside an event loop, which looks like this:

loop() ->
    receive
        {gs,_Win,destroy,_Data,_Args} -> bye;
        {gs,_Gridline,click,_Data,[Col,Row,Text|_]} ->
            io:format("Click at col:~p row:~p text:~p~n",[Col,Row,Text]),
            loop();
        Msg ->
            io:format("Got ~p~n",[Msg]),
            loop()
    end.

You set up a receiver and match messages following this pattern: {gs, IdOrName, EventType, Data, Args}

The original in RB’s IDE

The end result in X11

Erlang

Leave a Reply

You must be logged in to post a comment.