[Gambas-user] How to use MessageView when closing a form?

Jussi Lahtinen jussi.lahtinen at gmail.com
Thu Aug 26 21:42:10 CEST 2021


You should not use WAIT inside an event handler. Use sleep instead, if
there isn't a better solution (I would guess there is).
If the problem is high CPU usage, then simply increase the IDLE time,
example;
Sleep 0.3

Jussi



On Thu, Aug 26, 2021 at 8:09 PM bb <adamnt42 at gmail.com> wrote:

> (Internal #614)
>
> We are trying to show a MessageView when the user clicks on a button
> that closes the form or presses ESC. So in btnCancel_Click() we have
>
> Public Sub btnCancel_Click()
>
>   Action["Exit"].Enabled = False
>   mvwOutput.Open("Search abandoned", Picture["icon:/32/emote-sad"])
>
>   While mvwOutput.Visible
>     Wait 0.1
>   Wend
>
>   Me.Close
>
> End
>
> which works, but seems a terrible waste of electrons (top shows it
> using 7% CPU).
>
> Anyone got a better idea?
>
> tia
> bruce (&Caarol, Joe and Fels)
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210826/c406ac9b/attachment.htm>


More information about the User mailing list