[Gambas-user] dynamically timer gb.web.gui

Benoît Minisini g4mba5 at gmail.com
Thu Dec 24 19:47:06 CET 2020


Le 23/12/2020 à 21:50, Mayost Sharon a écrit :
> Hello
> 
> When I dynamically add a timer
> As the following code:
> 
> Export
> 
> Public hConsoleTimer As Timer
> 
> Public Sub WebForm_Open()
> 
>    hConsoleTimer = New Timer As "MyTimer"
>    hConsoleTimer.Delay = 1000
>    hConsoleTimer.Enabled = True
> 
> End
> 
> Public Sub MyTimer_Timer()
>    
>    WebLabel1.Text = CString(Now())
> 
> End
> 
> It went into the event
> But on the page I do not see the changes of time
> 
> If I manually add a timer and put it on the WebForm it works fine.
> 
> Thanks
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> 

It's because the GUI creates a "WebTimer", not a "Timer".

"Timer" ticks internally in the session server process, and can't force 
an update of the web browser client, whereas "WebTimer" ticks in the 
client web browser, and then can update the interface.

The update of the web page can only be done in a response to a request. 
It cannot be forced from the server if a request has not been initiated 
from the web browser, i.e. from a GUI event (bouton click, WebTimer 
tick...).

-- 
Benoît Minisini


More information about the User mailing list