GLBasic forum

Main forum => GLBasic - en => Topic started by: Ian Price on 2011-Jun-20

Title: Goto website, but not end program?
Post by: Ian Price on 2011-Jun-20
I've been using -
Code (glbasic) Select
NETWEBEND "http://www.iprice.remakes.org/micro/microsite.html"
- to visit my site (in this example), which also exits the app.

One reviewer left feedback for a webOS app that said he'd rather the app didn't end so that he could return to it after visiting the website - he stated that the app should multi-task. And I agreee.

Is it possible to pause the app, visit a site, then come back to it? The web and networking part of GLB is not a strong point, so I might have missed this. If not, is it possible to implement?

I'm not using ALLOWESCAPE TRUE/FALSE.
Title: Re: Goto website, but not end program?
Post by: Kitty Hello on 2011-Jun-20
I think you can control that with AUTOPAUSE or ALLOWESCAPE.
I'd start with ALLOWESCAPE FALSE -> that should leave the program open (and send GLB_ON_PAUSE messages)
Title: Re: Goto website, but not end program?
Post by: Ian Price on 2011-Jun-20
ALLOWESCAPE FALSE doesn't seem to work on Windows (for this instance) - I've tried it.

I'll try AUTOPAUSE now. :)


[EDIT] Neither have any effect in stopping program from exiting on Windows.
Title: Re: Goto website, but not end program?
Post by: MrTAToad on 2011-Jun-20
What I do is call the relevant PDK C function
Title: Re: Goto website, but not end program?
Post by: Ian Price on 2011-Jun-20
QuoteWhat I do is call the relevant PDK C function
Which is how, exactly?

And would it work on Windows/iPhone?
Title: Re: Goto website, but not end program?
Post by: Kitty Hello on 2011-Jun-20
Are you using V10 RC?
I checked my code and ALLOWESCAPE FALSE should work on windows certainly.
Title: Re: Goto website, but not end program?
Post by: Ian Price on 2011-Jun-20
No, sorry, still using V9.XX. I didn't know V10 RC was out.

To the download-mobile, Batman!

[EDIT] That RC download link still states that it's BETA when running the upgrader. ???
Title: Re: Goto website, but not end program?
Post by: Ian Price on 2011-Jun-20
OK. Stupid moment there. The reason it wasn't returning to the game on Windows was because I put it at the end of a function, without calling the next one. D'oh! Fixed that and it does indeed work on Windows. However, it still doesn't work on the Pre. The web is called and the program ends. It doesn't seem to matter whether you use ALLOWESCAPE FALSE and/or AUTOPAUSE TRUE.

Title: Re: Goto website, but not end program?
Post by: MrTAToad on 2011-Jun-20
QuoteWhich is how, exactly?

And would it work on Windows/iPhone?
It wouldn't work on Windows, of course - you would need to use ?IFDEF.  I use :

Code (glbasic) Select
FUNCTION callWebSite%:url$
?IFDEF WEBOS
INLINE
PDL_LaunchBrowser(url_Str.c_str());
ENDINLINE
?ELSE
NETWEBEND url$
?ENDIF
ENDFUNCTION


Although if it's running you dont need the above code :)
Title: Re: Goto website, but not end program?
Post by: Ian Price on 2011-Jun-20
Windows is running now, but not WebOS. I'll have a play with that tomorrow (going to work in a few mins).

Cheers MrTAToad.

BTW Is it TAT - TOAD. OR TATE OWED? Always wondered. I know your real name, but not your nick! :S
Title: Re: Goto website, but not end program?
Post by: MrTAToad on 2011-Jun-20
Its short for Tickle A Toad
Title: Re: Goto website, but not end program?
Post by: Ian Price on 2011-Jun-20
I'm not even going to ask! :P
Title: Re: Goto website, but not end program?
Post by: Ian Price on 2011-Jun-21
MrTAToad - I get an error when trying to compile your code for WebOS in v10.X. The code compiles for Windows, but not for Pre.

Quote
FUNCTION callWebSite%:url$
?IFDEF WEBOS
INLINE
   PDL_LaunchBrowser(url_Str.c_str());
ENDINLINE
?ELSE
   NETWEBEND url$
?ENDIF
ENDFUNCTION

Am I missing something? This inline stuff is pretty much alien to me nowadays.
Title: Re: Goto website, but not end program?
Post by: Kitty Hello on 2011-Jun-21
try:

Code (glbasic) Select

LOCAL url$="http://www.glbasic.com"

?IFDEF WEBOS
IMPORT int PDL_LaunchBrowser(const char* url);
PDL_LaunchBrowser(url$); // url$ <- we're not INLINE - silly me!
?ENDIF


... but it really should work with the NETWEBEND.
Title: Re: Goto website, but not end program?
Post by: Ian Price on 2011-Jun-21
It works (MrTAToad's code) on Windows - the music even continues in the background while browsing, but not on Pre. There's no music and the app terminates when you exit the browser.

I'll try your code now Gernot. :)
Title: Re: Goto website, but not end program?
Post by: Ian Price on 2011-Jun-21
Nope, your code (or a variant) fails to compile on WEBOS too Gernot.

Code (glbasic) Select

LOCAL url$="http://www.glbasic.com"

LOCAL web

WHILE TRUE

PRINT "HELLO",10,10

IF KEY(57) AND web=0

?IFDEF WEBOS
IMPORT int PDL_LaunchBrowser(const char* url);
PDL_LaunchBrowser(url_Str);
?ENDIF

web=1

ENDIF

SHOWSCREEN

WEND


I've turned off explicit declaration.

It comes up with this error -
Quote*** Configuration: WEBOS ***
precompiling:
GPC - GLBasic Precompiler V.7.917 SN:722cd5f9 - 3D, NET
"test.gbas"(21) warning : probably unassigned variable : url_Str
Wordcount:9 commands
compile+link:
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Elapsed: 3.6 sec. Time: 10:45
Build: 0 succeeded.
*** 1 FAILED ***

This is using GLBasic IDE, Version: 10.013.


Even trying to compile just your (RECENTLY EDITED) code fails.
Title: Re: Goto website, but not end program?
Post by: Kitty Hello on 2011-Jun-21
See my fix in ma post. Silly me. You need to call with url$ not url_Str - you're not INLINE.
Title: Re: Goto website, but not end program?
Post by: Ian Price on 2011-Jun-21
I did already. Your edit still does not compile (see my post above). :(
Title: Re: Goto website, but not end program?
Post by: MrTAToad on 2011-Jun-21
Are you trying to use the INLINE code in the main project file, with regards to my original code ?  INLINE cant be used with the main file...

Try this for Gernot's code (and works in the main project file too!) :

Code (glbasic) Select
?IFDEF WEBOS
IMPORT "C" int __stdcall PDL_LaunchBrowser(const char* url);
?ENDIF

?IFDEF WEBOS
PDL_LaunchBrowser("www.glbasic.com");
?ENDIF

SHOWSCREEN
KEYWAIT
Title: Re: Goto website, but not end program?
Post by: Ian Price on 2011-Jun-21
QuoteAre you trying to use the INLINE code in the main project file ?
Your code, yes. Where should it be? I don't know squat about INLINE. I've used only minimal INLINE statements in the past without problem, in the main project file.

Gernot's code (which doesn't use INLINE) doesn't compile (for PRE) either. Even as is. Does it for you?
Title: Re: Goto website, but not end program?
Post by: MrTAToad on 2011-Jun-21
INLINE can only be in any source file and in a function.

However, try my modified Gernot code first though :)
Title: Re: Goto website, but not end program?
Post by: Ian Price on 2011-Jun-21
Your new, adapted code did the trick MrTAToad. Cheers :)

[EDIT]
That really works a treat in a proper application.

:nw:

Many thanks. Cheers just isn't enough :)
Title: Re: Goto website, but not end program?
Post by: MrTAToad on 2011-Jun-21
QuoteI'm not even going to ask!
Probably wise :)

QuoteMany thanks
No problem!