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.

Using Timer To Close MsgBox?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-08-2008, 05:38 PM
Knows the basics
 
Join Date: Aug 2007
Location: Arkansas
Posts: 68
Default Using Timer To Close MsgBox?

How can I close out a MsgBox after 5 sec. of show time?
Reply With Quote
  #2 (permalink)  
Old 05-08-2008, 05:48 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Interesting question with a nice solution:
Code:
Sub App_Start
    Form1.Show
    Hardware1.New1
    timer1.Interval = 
5000
    timer1.Enabled = 
true
    
Msgbox("Some Message","title",cMsgboxOK)
    timer1.Enabled = 
false    
End Sub

Sub Timer1_Tick
    Timer1.Enabled = 
False
    Hardware1.KeyPress(
13)
End Sub
Reply With Quote
  #3 (permalink)  
Old 05-08-2008, 06:07 PM
Knows the basics
 
Join Date: Aug 2007
Location: Arkansas
Posts: 68
Default

Thanks Erel

That's the ticket.
Reply With Quote
  #4 (permalink)  
Old 05-09-2008, 11:06 AM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 623
Awards Showcase
Beta Tester 
Total Awards: 1
Default

@Erel,
How is this possible?
I would have expected to need DoEvents or Agraham's Threading library as I thought the MsgBox would normally halt program execution.
Yet it is obvious here that the Tick events are still caught even though the program is in the middle of running App_Start.

Regards,
RandomCoder
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #5 (permalink)  
Old 05-09-2008, 11:14 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

While the main (and only) thread waits for the msgbox to be closed it is free to handle other events.
Most user events will not happen as the form and all its controls are blocked until the msgbox is closed, however the timer continues to raise events.
Reply With Quote
  #6 (permalink)  
Old 05-09-2008, 11:20 AM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 623
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Thanks for the response, I understand now.
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #7 (permalink)  
Old 10-06-2010, 08:22 AM
Basic4ppc Expert
 
Join Date: May 2008
Location: Berkshire, UK
Posts: 810
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by Erel View Post
While the main (and only) thread waits for the msgbox to be closed it is free to handle other events.
Most user events will not happen as the form and all its controls are blocked until the msgbox is closed, however the timer continues to raise events.
Ah, I see now, rather too late, that I should have written a local wrapper Sub for MsgBox() calls that stopped my constantly-running timer while the message is shown, so that the program does not have to deal with the accumulated (and now useless) queued timer events afterwards!

Mike.
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
Event Countdown Timer dlfallen Share Your Creations 8 01-30-2010 06:15 AM
Timer component 2220 Questions (Windows Mobile) 4 09-27-2008 07:41 PM
How to use timer to clock speed of subs? Stellaferox Questions (Windows Mobile) 4 02-28-2008 07:07 AM
Msgbox Vito Questions (Windows Mobile) 2 11-19-2007 08:05 AM


All times are GMT. The time now is 09:25 AM.


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