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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer and Gotfocus

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,826
JP
Hi All,
I'm having a stupid moment. I am trying to implement a slight delay on an event in a ribbon bar button. When the mouse enters the button, there is a "Help Text" window that appears (you can see this in something like Word if you hover on any button, it pops up a little bit of information about the item, and how it is used). The problem I have is, in Office there is a slight delay between entering the object, and then the appearance of the menu, so that if you go quickly across the ribbon, it doesn't pop all the objects that you pass, only the one you "land" on. This is done by using a slight 1/2 second or so delay.

So in my button container that gets the focus, in the GOTFOCUS() I have this:

Code:
This.Timer1.Interval = 10000
This.Timer1.Timer
*
	IF This.Parent.Parent.Parent.Name = "Mainribbon1"
		DO FORM RIBBONHELP WITH OBJTOCLIENT(This.Parent,1)+OBJTOCLIENT(This.Parent,4)+2, OBJTOCLIENT(This,2), This.Buttonlabel1.Caption, This.buttonimagebase1.Picture, (This.Name)
	ELSE
		DO FORM RIBBONHELP WITH OBJTOCLIENT(This.Parent,1)+ThisForm.Top+OBJTOCLIENT(This.Parent,4)+2, OBJTOCLIENT(This,2), This.Buttonlabel1.Caption, This.buttonimagebase1.Picture, (This.Name)
	ENDIF
ENDIF

There is a timer control in the container for the button.
But there isn't a pause as I want before the RIBBONHELP is displayed.
How can I get the timer to pause before the RIBBONHELP fires, and if you move on, it doesn't fire.


Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Enabled = .f.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Scott,

The way I do this is to set the timer interval in my ShowTip method. This is the method that actually displays the Help window. It is ultimately called from the riboon button's MouseEnter event. After setting the interval, I set the timer's Enabled to .T.

In the HideTip method, which is ultimately called from the MouseLeave method of the ribbon button, I simply set the timer's Enabled to .F.

My scenario is slightly different than yours, because I show and hide the Help when the user hovers over any of the buttons in the ribbon, rather than when they click a specific button. But I believe the general idea is the same.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
The other thing I do that is different is to keep the Help form open the whole time, but to make it visible or invisible when I want to actually display the Help. This makes the system a bit more responsive. In fact, the whole thing is vey slick.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top