wx:batch/1 on Windows 10

Dmitry Belyaev be.dmitry@REDACTED
Tue Jan 28 01:22:59 CET 2020


Maybe

batch(Window, Fun) ->
ok = wxWindow:freeze(Window),
try
   Fun()
after ->
   ok = wxWindow:thaw(Window)
end.

would be better

On 26 January 2020 12:59:23 pm AEDT, zxq9 <zxq9@REDACTED> wrote:
>On 2020/01/21 20:16, Dan Gudmundsson wrote:
>>      > One thing that have changed is wxWidgets version, i.e. upgrade
>>     from 2.8
>>      > to 3.0.3 (soon to be 3.1 on windows),
>>      > but I don't know what is causing this, nor how where is should
>be
>>     fixed
>>      > in the application code,
>>      >   wx wrapper or wxwidgets library.
>
>Hi, again.
>
>After confirming the behavior (and also finding that freeze/1, [make 
>stuff], thaw/1 doesn't work on Windows) someone in the SO Erlang
>channel 
>found this bug that has been around forever and seems to apply only to 
>wxMSW:
>
>https://trac.wxwidgets.org/ticket/10748
>
>The description is exactly the problem I see. Hopefully they'll get
>this 
>cleared up. It is a very weird problem. I imagine I can create a 
>workaround, but will need a few hours to mess with it to figure out a
>way.
>
>If they fix freeze/thaw on all platforms then a non-hacky
>implementation 
>of batch/1 could be:
>
>
>   -spec batch(Window, Fun) -> Result
>       when Window :: wx:wx_object(),
>            Fun    :: fun(),
>            Result :: term().
>
>   batch(Window, Fun) ->
>       ok = wxWindow:freeze(Window),
>       Result = Fun(),
>       ok = wxWindow:thaw(Window),
>       Result.
>
>Fingers crossed this is addressed in 3.1.
>
>-Craig

-- 
Kind regards,
Dmitry Belyaev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200128/031bbcbd/attachment.htm>


More information about the erlang-questions mailing list