Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Wait for an event result within a sub

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-25-2009, 04:37 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
Default Wait for an event result within a sub

Hi guys...
is it possible to wait for an event result within a sub???
Ie:
Ussing a webbrowser object, call the navigate method, and wait for it to raise the navigated event in order to retrieve some info...
I know that i can do it with cascating subs....sub is it possible to without leaving the same sub?
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)

My Posts helped you? Consider Buying me a Porto Glass!
Reply With Quote
  #2 (permalink)  
Old 01-25-2009, 06:18 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by Cableguy View Post
call the navigate method, and wait for it to raise the navigated event in order
If you need to do this then your program structure is probably not optimal. The problem is that the event sub needs to run on the main thread and your call to the navigate method is also on this thread so you need to exit your sub so that the message loop can run to process the event code.

Quote:
I know that i can do it with cascating subs....
For the reason given above I don't think you can!

You can do it with a loop around DoEvents but it is a bit inelegant and burns processor cycles, but on a desktop it probably doesn't matter.
Code:
Flag = false
Web.Navigate(somewhere)
Do While Flag = false
  
DoEvents
Loop
...


Sub Web_Navigated
  DoStuff
  Flag = 
true
End Sub
Reply With Quote
  #3 (permalink)  
Old 01-25-2009, 06:54 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Thanks andrew...
I need to re-think all the aproach....
DllToDate relies on a lot of navigated events, so I'm already using flags, but it will be a bit more easyer now that I know HOW to DOWNLOAD a file from the restricted area...
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)

My Posts helped you? Consider Buying me a Porto Glass!
Reply With Quote
  #4 (permalink)  
Old 01-25-2009, 07:05 PM
taximania's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire. UK
Posts: 592
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Agraham sorted my head out in this thread in a previous app of mine.

http://www.basic4ppc.com/forum/quest...l-no-deal.html

Can't you start a timer and check in the tick event to see if you get a response from the webbrowser thingy ?
When you get a response, kill the timer.


But I'm probably wrong again.

And you beat my post :-)
__________________
.
.
.
Don't ask, I'm fine, honest. !!
.
.
.
Just a little crazy at times



O2 XDA, GW Evo 2.1 UC WWE Rom, WM6.1
Radio Ver 03.34.90
With Basic4ppc V6.80


http://www.taximania.co.uk

Last edited by taximania : 01-25-2009 at 07:12 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
The Mousemove event N1c0_ds Questions (Windows Mobile) 1 11-08-2008 03:36 PM
Shell and wait Erel Code Samples & Tips 0 03-26-2008 03:14 PM
Shell and wait while process is running g0dspeed Questions (Windows Mobile) 2 03-22-2008 09:48 AM
Inconsistant compiler result glook Questions (Windows Mobile) 3 03-04-2008 06:44 PM
Wait cursor library agraham Code Samples & Tips 2 07-07-2007 02:49 PM


All times are GMT. The time now is 03:45 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0