[SOLVED] Opening a window inside a callback?
Posted: Thu Sep 26, 2019 6:13 am
Hi,
I'm stuck! I'm not sure how i should code the following scenario. As soon as my page opens, the first thing it does is send a http request to a server. I have verified this bit works and a result from the server is passed back to the httprequest callback. This bit also works and i can debug the result. I want to open my first window based on the value sent from the server but "openwindow()" does not seem to work from a callback or normal procedure. Is there a way to get the result to main loop from a callback? or am i going about it the wrong way?
I'm stuck! I'm not sure how i should code the following scenario. As soon as my page opens, the first thing it does is send a http request to a server. I have verified this bit works and a result from the server is passed back to the httprequest callback. This bit also works and i can debug the result. I want to open my first window based on the value sent from the server but "openwindow()" does not seem to work from a callback or normal procedure. Is there a way to get the result to main loop from a callback? or am i going about it the wrong way?
Code: Select all
Procedure CloseWindowEvent()
Debug "Closing window: " + EventWindow()
CloseWindow(EventWindow())
EndProcedure
Procedure HttpGetEvent(Success, Result$, UserData)
If Success
Select Result$
Case "LOGIN"
OpenWindow(1,0,0,300,200,"Login")
EndSelect
Else
Debug "HTTPRequest(): Error"
EndIf
EndProcedure
HTTPRequest(#PB_HTTP_Get, "https://spacenetcy.net", "", @HttpGetEvent())