[erlang-questions] wxErlang

Dan Gudmundsson dgud@REDACTED
Tue Apr 15 09:19:35 CEST 2008


I have made a new release, slogan: "now without eternal loops".
/Dan

Dan Gudmundsson wrote:
> Comments below.
> 
> Bob Cowdery wrote:
>> Dan
>>
>> 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
>> with.
>>
>> 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.
> 
> Yes I fixed the nc_paint <-> paint, which was a bug in previous releases,
> I noticed that it changed how often the events was fired I don't know
> the reason, but I solved it by using a buffered-DC, which you are already
> using, and set the appropriate skip option in the connect call.
> 
> I wonder if you have to use callbacks for those events?
> 
>> 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.
> 
> I will take a look at wxDc:drawLines and see if I've introduced a bug or two,
> I'll email you privately.
> 
> Thanks
> /Dan
> 
>> Regards
>> Bob
>>
>> ------------------------------------
>> -module(test_ui).
>>
>> -include("..\\include\\wx.hrl").
>>
>> -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) ->
>>     receive
>>         {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}]),
>>             wxBufferedDC:destroy(Dc),
>> wxClientDC:destroy(CDc),
>>             server_loop(GrFrame, B)  
>>     end.
>> --------------------------------------
>>
>> 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
>>> erlang-questions@REDACTED
>>> http://www.erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
> 



More information about the erlang-questions mailing list