[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New control structure "Do Next..."


cool.  I think this could be a solution to many a quirk I have faced.

Particularly when loading a GUI that does not configure properly at
Form_Open() because certain elements have yet to be created and properly
sized.
Or programs i want the window to show before the data fills the controls.

Plus it might also have a handy use to workaround the old "Cannot use Wait
in a Key event" error

Thanks Benoit :)
Respects
BruceS


On Sat, 17 May 2025 at 00:33, Benoît Minisini <
benoit.minisini@xxxxxxxxxxxxxxxx> wrote:

> Hi,
>
> I have just added a new control structure to the Gambas language:
>
>    Do Next <statement>
>
> It executes the statement "later", i.e. at the next run of the event loop.
>
> To do the same thing, you had to use a Timer before. Something like that:
>
>    hTimer = New Timer As "RunLater"
>    hTimer.Trigger
>
>    ...
>
>    Public Sub RunLater_Timer()
>
>      <statement>
>
>    End
>
> I'm not yet fully satisfied with that syntax, even if it does not
> introduce new keywords, which is always a positive thing.
>
> But I may do something else:
>
>    Do <statement> Next
>
>    Do <statement> Later
>
> Or more powerful:
>
>    Do
>      <statement 1>
>      <statement 2>
>      ...
>    Next
>
> Internally, the <statement> is directly compiled inside the function,
> and is run in a special context where there is no local variable.
>
> You can't use the local variables of the function inside <statement> at
> the moment.
>
> This is not a lambda expression, for those who know what it is.
>
> And I think you can still do something like 'Do Next Goto ...' which
> must be forbidden too. So a work in progress...
>
> Do not hesitate to tell what you think and give ideas.
>
> Regards,
>
> --
> Benoît Minisini.
>
>
>

References:
New control structure "Do Next..."Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>