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

Using Popups on Forms

Status
Not open for further replies.

hjohnson

Programmer
Aug 1, 2001
90
US
I'm probably missing something rather simple. but I'm tring to use a popup on a form when a button's Click event is triggered.

****
Release POPUP ButtonPop EXTENDED
Define POPUP ButtonPop Title 'Imports' SHORTCUT RELATIVE FROM MROW(), MCOL()
****

The mrow() and Mcol() work just fine when the button is clicked with the mouse, but when the user tabs to the button and presses enter, the popup can be just about anywhere.

What I would like to do is either find out how to determin the Mrow/Mcol location of the top-left corner of the button or force the mouse to be over the button when Enter is pressed.

Thanks

Hal
 
Seems to me you need to use MDOWN() to set a flag in MouseDown to figure out whether the user clicked or used the keyboard. Clear it once you've checked it in Click.

If the user used the mouse, then MROW(), MCOL() is good. If not, use This.Left and This.Top or some variation of those to set the position of the pop-up.

Any reason you're firing the shortcut menu on Click rather than Right-Click?

Tamar
 
Or, in the button's gotfocus move the mouse pointer:

If Mdown()
Mouse At this.top, this.left
Endif
 
But then you've moved the mouse on the user, something I try to avoid.

Tamar
 
If moving the mouse would work, I'd settle for that, but it won't. I wan the popup to always be in the same position relative to the command button that invokes it.

I can't use this.top/left because those points are relative to the the buttons position on the form and can vary depending the form size/resize. The mrow/mcol() are based on the VFP screen.

What I'm really after is to reference the location on the command button regardsless of any resizing or whether clicked or pressed end can that be used to call the line below.

Define POPUP ButtonPop Title 'Some_title' SHORTCUT RELATIVE FROM lnRowPosition, LnColPosition()

Thanks

Hal
 
I don't understand. If the button has been moved, don't you want the menu to pop up at the new position? Seems to me using This.Top and This.Left and adding a few pixels to move to the right and maybe down should give you exactly what you need.

That is, I'm saying that your DEFINE POPUP command should refer to the button itself.

Tamar
 
I apologize, but guess I wasn't explaining this very clearly, but That is exactly what I'm trying to do.

I would like the popup to alway be tied to the button positions, but using the this.top and this.left when defining the popup does not work. When defining the popup I've been using ' .. From mrow(), mcol()' becuase it is alway relative to the active window regardless of the any resizing of the form. The problem is that when the button is not click (user tabs to then presses enter), the popup appears wherever the mouse is. If I define the popup with this.top, this.left it doesn't even appears on the form.

What I would like to find is how to find the coordinates of the top/left corner that would match the same mrow()/mcol() values if I were to click top/left corner with the mouse.

Thanks

Hal
 
The problem is, that mrow() and mcol() or the values DEFINE POPUP expects don't measure pixels but foxels. This comes from the textoriented days of Foxpro for DOS. It also depends on the font that is set for _screen and or the active form, because foxels are sonething like the medium width or typical height of a letter.

You find a rather complex calculation example in the solutions app in the classlib newtbars.vcx in the class tbar1 and it's method showdropdownmenu().

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top