Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer not firing in a menu

Status
Not open for further replies.

Mike Lewis

Programmer
Jan 10, 2003
17,516
Scotland
I've received an email from a developer complaining about a problem with my ForcedClosedown class (which lets an adminstrator force users to log out of an application).

The root of the developer's problem is that a timer is not firing when the user is interacting with a menu. In other words, if the user opens a pulldown menu and points to one of the menu bars, for as long as the mouse is on that item, no timer will ever fire.

I've never heard of timers not firing when a menu is active, nor can I reproduce the problem.

Does anyone have any experience of knowledge of this issue?

Thanks in advance.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hmm

Not my experience Mike. Just tested it on our VFP7 app running W2k and XPPro, as you know we have various timers but they all seem to work despite the mouse holding down a dropdown.



Bob Palmer
The most common solution is H2O!
 
Mike,
This works perfect for me:
Code:
GenerateMenu()
lcTimer = NEWOBJECT([MyTimer])
READ EVENTS


FUNCTION GenerateMenu()
SET SYSMENU TO
SET SYSMENU AUTOMATIC

DEFINE PAD _Test1 OF _MSYSMENU PROMPT [Test1]
DEFINE PAD _Test2 OF _MSYSMENU PROMPT [Test2]
DEFINE PAD _Test3 OF _MSYSMENU PROMPT [Test3]
DEFINE PAD _Test4 OF _MSYSMENU PROMPT [Test4]
DEFINE PAD _Test5 OF _MSYSMENU PROMPT [Test5]
ON PAD _Test1 OF _MSYSMENU ACTIVATE POPUP _TestMe


DEFINE POPUP _TestMe MARGIN RELATIVE COLOR SCHEME 4
DEFINE BAR 1  OF _TestMe PROMPT [BAR 1]
DEFINE BAR 2  OF _TestMe PROMPT [BAR 2]
DEFINE BAR 3  OF _TestMe PROMPT [BAR 3]
DEFINE BAR 4  OF _TestMe PROMPT [BAR 4]
DEFINE BAR 5  OF _TestMe PROMPT [BAR 5]
DEFINE BAR 6  OF _TestMe PROMPT [BAR 6]
DEFINE BAR 7  OF _TestMe PROMPT [BAR 7]
DEFINE BAR 8  OF _TestMe PROMPT [BAR 8]
DEFINE BAR 9  OF _TestMe PROMPT [BAR 9]
DEFINE BAR 10 OF _TestMe PROMPT [BAR 10]
DEFINE BAR 11 OF _TestMe PROMPT [BAR 11]
RETURN


DEFINE CLASS MyTimer AS Timer
     lnCount = 0
     Interval = 100
     
     
     PROCEDURE Timer
          WAIT WINDOW NOWAIT NOCLEAR DATETIME()
          this.lnCount = this.lnCount + 1
          IF this.lnCount > 200 OR;
             INKEY() == 27
             this.Enabled = .f.
             CLEAR EVENTS
             WAIT CLEAR
             SET SYSMENU TO DEFAULT
          ENDIF
     ENDPROC
ENDDEFINE

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Bob + Borislav,

Thanks for your replies. These confirm my own experience and expectations.

I really don't know why this particular developer is having a problem, but I feel pretty sure it is not my code that is causing it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
I am sure that the problem is not in your code. Did you ask him what HE/SHE uses for Menu system? Because I use Doug Henig VFPx OO Menu, He/She can use something other like Command Bars Library or some ActiveX control. Maybe they caused that problem.

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Check VFP version, too. In VFP 3 (could he possibly be using that?), timers didn't fire when the menu was dropped open.

Tamar
 
Tamar,

In VFP 3 (could he possibly be using that?), timers didn't fire when the menu was dropped open.

Good thought. But they are using 9.0.

I'm going to write this one off. Nobody else has come back to me with this problem since I published the code. For now, I'll assume it's something weird in this particular developer's environment.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mystery solved.

It turns out this developer has READ VALID in his code. It seems that timers don't fire while a READ VALID is active and the focus is somewhere other than the screen being read.

I advised him to refactor the code so as to avoid using READ VALID and similar arcane and ancient commands.

Since my ForcedClosedown class is flagged as needing VFP 8.0 and above, it's a safe bet that no-one else will face this problem, but I'll add a note to the download just in case.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top