[erlang-questions] wxErlang

Bob Cowdery <>
Sat Apr 12 17:58:07 CEST 2008


That's good news, the new classes are gratefully received. 

I'm having a few issues with the new release which I hope you can help

The code below should demonstrate.

1. In the previous release if I connected to 'paint' I received a
message {wx,_,{wx_ref,_,wxFrame},{wxNcPaint,paint}}. In this release I
think I correctly receive {wx,_,{wx_ref,_,wxFrame},_,{wxPaint,paint}}.
However, these events fire continuously and take my processor to 100%. I
found however that I could connect to 'nc_event' and receive
{wx,_,{wx_ref,_,wxFrame},_,{wxNcPaint,nc_paint}} and these events only
fire when they should do. However, I think NC means the non-client area
and the wrong thing to attach to.

2. In the code I have commented out a call to drawLines/2. Although this
draws correctly my processor goes up to 50% and the window hangs (i.e
'not responding' in the title bar). I used this call a lot in the
previous release without any problems.




-export([start/0, server_process/0]).

start() ->
    spawn(?MODULE, server_process, []). 
server_process() ->
    _WX = wx:new(),
    GrFrame = wxFrame:new(wx:null(), 1,
"Window",[{style,?wxFRAME_TOOL_WINDOW bor ?wxCAPTION}]),
    wxFrame:connect(GrFrame, nc_paint),
wxFrame:show(GrFrame, []),
    B = wxBrush:new(?wxBLACK, []), 
    server_loop(GrFrame, B).

server_loop(GrFrame, B) ->
        {wx,_,{wx_ref,_,wxFrame},_,{wxNcPaint,nc_paint}} ->
            CDc = wxClientDC:new(GrFrame),
Dc = wxBufferedDC:new(CDc),
    wxDC:setBackground(Dc, B),
            {W,H} = wxWindow:getSize(GrFrame),
wxDC:drawRoundedRectangle(Dc, {2,2}, {W-4,H-4}, 3.0),
            %wxDC:drawLines(Dc, [{10,10},{20,10},{20,20},{10,20}]),
            server_loop(GrFrame, B)  

On Fri, 2008-04-11 at 16:30 +0200, Dan Gudmundsson wrote: 
> I've made a new release.
> http://www.erlang.org/~dgud/wxerlang
> Fixed a lot of bugs, less memory leaks, added some missing totally untested classes and 
> re-wrote the connect/event api, so it's now incompatible with previous releases :-)
> NOTE it requires OTP-R12-2 though.
> Basically bigger, better and faster.
> Regards
> /Dan
> _______________________________________________
> erlang-questions mailing list
> http://www.erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list