![]() |
PopupMenu Alignment |
Post Reply ![]() |
Author | |
amstel ![]() Newbie ![]() Joined: 23 February 2004 Location: France Status: Offline Points: 18 |
![]() ![]() ![]() ![]() ![]() Posted: 11 March 2004 at 6:38am |
How to center a popupmenu in a screen or align at a button ?? Thanks |
|
![]() |
|
SuperMario ![]() Admin Group ![]() ![]() Joined: 14 February 2004 Status: Offline Points: 18057 |
![]() ![]() ![]() ![]() ![]() |
To center a popup menu on the screen you just pass in the x and y
coordinantes of the screen to the CommandBars.ShowPopup method. I
believe this will only work for command bars of type xtpBarPopup, but I
could be wrong.
Set Popup = CommandBars.Add("Popup", xtpBarPopup) With Popup.Controls &nbs p; .Add xtpControlButton, ID_FILE_NEW, "&New" &nbs p; .Add xtpControlButton, ID_FILE_OPEN, "&Open" &nbs p; .Add xtpControlButton, ID_FILE_SAVE, "&Save" End With Popup.ShowPopup 100, 100 Hope this helps. ![]() |
|
![]() |
|
robs ![]() Groupie ![]() Joined: 09 November 2003 Status: Offline Points: 84 |
![]() ![]() ![]() ![]() ![]() |
Also note that supplying the x,y is optional. If they are omitted, the popup will display at the current screen cursor position.
|
|
![]() |
|
amstel ![]() Newbie ![]() Joined: 23 February 2004 Location: France Status: Offline Points: 18 |
![]() ![]() ![]() ![]() ![]() |
Ok, but coordinates is coordonates of the screen !!! I want show a popupMenu in the form at coordinate of this form... It is possible ? Edited by amstel |
|
![]() |
|
amstel ![]() Newbie ![]() Joined: 23 February 2004 Location: France Status: Offline Points: 18 |
![]() ![]() ![]() ![]() ![]() |
It's not possible ????
|
|
![]() |
|
robs ![]() Groupie ![]() Joined: 09 November 2003 Status: Offline Points: 84 |
![]() ![]() ![]() ![]() ![]() |
amstel: Paste this code in the DynamicPopus sample. Does it do what you would expect? Private Sub frameChild_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) |
|
![]() |
|
SuperMario ![]() Admin Group ![]() ![]() Joined: 14 February 2004 Status: Offline Points: 18057 |
![]() ![]() ![]() ![]() ![]() |
It appears that this method will only accept constant values as
parameters. Any time you pass in a value generated at runtime it
will use the x and y coords of the mouse. I did several tests and
I have found no way to make this work. It only appears to work in
the MouseDown event because you expect the popup to be displayed where
you clicked with the x and y passed to the event. But the values passed
to the event do nothing in the showpopup method. Try changing
the value of x and y with a value
stored in a variable, if you hard code it like x=100, that will work
but that is no good at runtime. But x=me.width will not work
because it is not a constant. I can think of a couple ugly
workarounds, but it would be nice to pass in a variable as x and y.
Edited by SuperMario |
|
![]() |
|
robs ![]() Groupie ![]() Joined: 09 November 2003 Status: Offline Points: 84 |
![]() ![]() ![]() ![]() ![]() |
SuperMario is right. I assumed that the x and y would come from a mouse event (as they normally are when showing a popup). I tried a bunch of workarrounds, but came up short so far.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |