Browser window?

BlitzMax Forums/BlitzMax Beginners Area/Browser window?

ima747(Posted 2009) [#1]
I have a fullscreen game, but for some things (registration, setting up an account etc.) I would like to open a web page. OpenURL() works fine, but I can't tell when the user is done on the web page and ready to go back to the game unless I pop up a notify saying "click ok when you are ready to return to the game". Is there a way I can watch the browser's thread to see when it's done? or better yet integrate a browser window into the game? and of course I need it to be cross platform just to make things that much more anoying...


Warner(Posted 2009) [#2]
I don't suppose there is an easy crossplatform solution to this. In Windows alone, it would be quite difficult, using the FindWindow api or something. I have no idea how it should be done on Mac OS or Linux.
Alternatively, you could maybe use the AppSuspended() function to detect when your game regains focus, or indeed write your own browser functionality.
Maybe it is worth taking a look in the code archives under "networking" for that.


Otus(Posted 2009) [#3]
Is there a way I can watch the browser's thread to see when it's done?


Maybe, but that's not a good idea.

If the user already has a browser window open (as I at least usually do), URL requests most likely open there. In that case the user could close a tab after he's done, but probably not the whole browser.

A better idea would be what Warner suggested. Something like:

UpenURL(url)

If AppSuspended()
	While AppSuspended()
		WaitSystem
	Wend
Else
	Notify("Let me know when you're ready.")
End If



Arowx(Posted 2009) [#4]
Another approach might be to launch a window using MaxGUI's HTMLView component and return to the game once it is closed?


ima747(Posted 2009) [#5]
I initially used the appsuspended() method but it was unreliable cross platform. I don't recall the exact problem, but I think it was on OS X, depending on your browser settings, wether it's open already etc. it won't always pop up the browser window, so I had to close the graphics before opening the window, but since the graphics were closed it couldn't tell if the app was suspended because there were no graphics. And when I called the graphics again it takes over so it's no longer suspended... sort of a catch 22.

I haven't used maxgui yet, but I'm not averse to taking the plunge. How does HTMLView work or where can I find some documentation on it?


jsp(Posted 2009) [#6]
From the help:
The HTMLView is a complete web browser object inside a MaxGUI gadget. The HTML page displayed is controlled with the HTMLViewGo command or from the user navigating from within the currently viewed page.

An example with a startup page:



And an example running a script:


If the HTMLVIEW_NONAVIGATE style is selected, EVENT_GADGETACTION is generated when the user clicks on a link with EventText containing the requested URL.

EVENT_GADGETDONE events are generated at the completion of a page load.


ima747(Posted 2009) [#7]
That looks like what I need more or less. Do you know if the browser is an OS standard (safari based on OSX and IE on windows) or an internal browser in blitz? i.e. should I expect browser problems when viewing the pages or should it be 100% standard with java, css, etc...


jsp(Posted 2009) [#8]
OS standard for win and mac and hopefully no big problems...
Don't know how far markcw got with the linux version. Check out this:
http://www.blitzbasic.com/Community/posts.php?topic=79710#895003


ima747(Posted 2009) [#9]
awsome, thanks! not planing on a linux port at the moment because my linux box is smoldering in a corner, but maybe when I can get it up again.

Thanks everyone for the help!