Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DEFINE POPUP Problem
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
DEFINE POPUP Problem
Divers
Thread ID:
00689242
Message ID:
00689242
Vues:
65
I'v create a toolbar button class that pops up a menu just like MS Outlook does.

It all works fine except for one problem; When there is a form open, the menu
pops up half way off the left side of the screen. What I would really like is
to have the menu's top & left be aligned with the bottom/left corner of the
button, regardless of the position of the toolbar. The buttons are actually
containers set to hot-track when the mouse passes over them.

Menu information is taken from an array property called .aMenuInfo which is
loaded in the Init of the button:
.aMenuInfo[1,1] = "Open Client" && Prompt
.aMenuInfo[1,2] = "Images\Menu\Client.Bmp" && Image
.aMenuInfo[1,3] = "Opens an existing Client" && Tooltip text
Any ideas?

When the down-arrow container on the class is clicked, this method is run:
WITH This

  IF .Enabled
    .DisplayMenu(This)
  ENDIF
	
  ENDWITH

RETURN
Here's the DisplayMenu code:
LPARAMETERS oMenuObj

  ** Define variables
  LOCAL nBar, cPrompt

  WITH This

    ** Determine top/left of the menu
    nRow = MROW() + 1
    nCol = MCOL() - 7.5

    ** Define the popup  
    DEFINE POPUP ShortCuts FROM nRow, nCol IN SCREEN SHORTCUT

    ** Loop once for each menu item in the array
    FOR nBar = 1 TO ALEN(.aMenuInfo, 1)
	  
      ** Extract the prompt and the picture
      cPrompt = .aMenuInfo[nBar, 1]
      cPicture = .aMenuInfo[nBar, 2]
	  	
      ** If the prompt is empty, make it a separator
      IF EMPTY(cPrompt)
        DEFINE BAR nBar OF ShortCuts PROMPT "\-"
      ELSE
        DEFINE BAR nBar OF ShortCuts PROMPT cPrompt PICTURE cPicture 
      ENDIF
		  
    ENDFOR

    ** Define selection actions
    ON SELECTION POPUP ShortCuts oMenuObj.MenuSelect()

    ** Show the popup
    ACTIVATE POPUP ShortCuts

  ENDWITH

RETURN
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform