Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Define popup at location
Message
De
01/07/2002 15:15:39
Irv Adams
MSC Managed Care, Inc.
Floride, États-Unis
 
 
À
30/06/2002 06:08:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00673253
Message ID:
00674076
Vues:
43
I think you may have something here, I'm going to check this out. It is true that the Popup location is further away as I move right within the Grid, so the relative Foxels (pixels) may be the culprit.

I'll test out your ideas...thanks !

-Irv.


>Irv,
>
>It has become a bit clearer overnight
>
>As far as I understand it ..
>
>Both mRow() and mCol return a position (in foxels) with respect to the average char height and char width of the current font of the Current active form.
>(Activating the screen prior to using mrow() and mcol() returns what we need)
>
>The activate popup at y, x is with respect to the average char height and char width of the current font of the main visual foxpro window, but 0,0 is equal to the upper left corner of the form
>
>My screenfont is Courier New and the fontsize is 10
>All my forms have Arial size 9
>
>So if the Col on the form is say 20, the activate at y, 20 will be far off to the right since 20 will be counted with avg char width of 8 (size 10) where avg char width of arial 9 is 5
>
>The further you click to the right of the form, the bigger the distance from the mouse to where the popup appears gets (x).
>The further down you click on the form, the bigger the distance from the mouse to where the popup appears gets (y).
>
>
>There are two possibilities. Try them and see whether they work
>
>
>(1) have the font and size of your form equal to the font and size of the main screen
>
>(2) translate, code below seems like working although it may still need some adjustments
>
>
>&& Form mousedown()
>
>LPARAMETERS nButton, nShift, nXCoord, nYCoord
>
>
>local p
>p = sys(2015)
>define popup (p)
>define bar cntbar(p)+1 of (p) prompt '111'
>define bar cntbar(p)+1 of (p) prompt '222'
>
>
>do case
>case nShift == 0
>	do case
>	case nButton == BUTTON_RIGHT
>		NoDefault
>		acti popup (p) at mRowReal(), mColReal()
>		
>		release popup (p)
>		
>	endcase
>endcase
>&& end of form.MouseDown()
>*--------------------------------------------------------------------------
>function mColReal()
>	local x
>	*x = mCol() / FontMetric(6, _screen.FontName, _screen.FontSize) * FontMetric(6, wfont(1), wfont(2))
>	x = mCol() / FontMetric(6, wfont(1,wparent()), wfont(2,wparent())) * FontMetric(6, wfont(1), wfont(2))
>
>	return x
>endfunc
>*---------------------------------------------------------------------------
>function mRowReal()
>	local x
>	*x = mRow() / FontMetric(1, _screen.FontName, _screen.FontSize) * FontMetric(1, wfont(1), wfont(2))
>	x = mRow() / FontMetric(1, wfont(1,wparent()), wfont(2,wparent())) * FontMetric(1, wfont(1), wfont(2))
>	return x
>endfunc
>*---------------------------------------------------------------------------
>
>
>>I have a problem with menu appearing off to the Right during a Popup on top of a Grid...just tried the idea below but it didn't help (thanks anyway)...the wierd thing is that it is always off straight to the RIGHT, as if Mrow(),Mcol()-x might work...?
>>
>>-Irv.
>>
>>
>>>Jerry,
>>>
>>>Just picked something up from the newsgroup. Have not tested it but it may help explaining
>>>
>>>(dan Freeman)
>>>quote
>>>
>>>The problem with MROW() and MCOL() is that they always return coordinates
>>>relative to _screen, UNLESS YOU PASS THEM A WINDOW NAME. That's where
>>>MWINDOW() comes in.
>>>
>>>ACTIVATE POPUP whatever AT MROW(MWINDOW()), MCOL(MWINDOW())
>>>
>>>You can find out what object (control) is under the mouse with sys(1270) and
>>>query its top/left, but that's not very useful for "large" objects.
>>>AMOUSEOBJ() may also be of help to you.
>>>
>>>endquote
>>>
>>>>Gregory,
>>>>
>>>>That worked! Wierd it works that way but I'll take.
>>>>
>>>>Thanks for your help.
>>>>
>>>>Jerryt
>>>>
>>>>
>>>>
>>>>>>How can I always make the popup display right on top of the command button?
>>>>>>
>>>>>>***Here's the code in my button CLICK() method.
>>>>>>DEFINE POPUP shortcut SHORTCUT RELATIVE FONT "Arial", 9
>>>>>>DEFINE BAR 1 OF shortcut PROMPT "Mybar1" MARK "*" STYLE 'B' ;
>>>>>> MESSAGE "Mybar1 message" ;
>>>>>> FONT "Arial", 8
>>>>>>***More bars go here.
>>>>>>
>>>>>>ACTIVATE POPUP shortcut AT ROW(), COL()
>>>>>>
>>>>>>
>>>>>
>>>>>What has worked for me is to put activate screen just before activating the popup
>>>>>
>>>>>Activate Screen
>>>>>activate popup shortcut at mRow(), mCol()
>>>>>
>>>>>Don't ask me why, I don't know
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform