Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - PopupMenu Alignment
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

PopupMenu Alignment

 Post Reply Post Reply
Author
Message
amstel View Drop Down
Newbie
Newbie


Joined: 23 February 2004
Location: France
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote amstel Quote  Post ReplyReply Direct Link To This Post Topic: PopupMenu Alignment
    Posted: 11 March 2004 at 6:38am

How to center a popupmenu in a screen or align at a button ??

Thanks

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 11 March 2004 at 7:27am
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.
Back to Top
robs View Drop Down
Groupie
Groupie


Joined: 09 November 2003
Status: Offline
Points: 84
Post Options Post Options   Thanks (0) Thanks(0)   Quote robs Quote  Post ReplyReply Direct Link To This Post Posted: 11 March 2004 at 8:04am

Also note that supplying the x,y is optional. If they are omitted, the popup will display at the current screen cursor position.

 

Back to Top
amstel View Drop Down
Newbie
Newbie


Joined: 23 February 2004
Location: France
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote amstel Quote  Post ReplyReply Direct Link To This Post Posted: 11 March 2004 at 11:06am

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
Back to Top
amstel View Drop Down
Newbie
Newbie


Joined: 23 February 2004
Location: France
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote amstel Quote  Post ReplyReply Direct Link To This Post Posted: 13 March 2004 at 9:00am
It's not possible ????
Back to Top
robs View Drop Down
Groupie
Groupie


Joined: 09 November 2003
Status: Offline
Points: 84
Post Options Post Options   Thanks (0) Thanks(0)   Quote robs Quote  Post ReplyReply Direct Link To This Post Posted: 13 March 2004 at 11:52am

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)
  Dim p As XtremeCommandBars.CommandBar
  Set p = CommandBars.Add("Test", xtpBarPopup)
  p.Controls.Add xtpControlButton, ID_FILE_OPEN, "Test"
 
  p.ShowPopup , X, Y
 
End Sub

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 13 March 2004 at 1:47pm
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
Back to Top
robs View Drop Down
Groupie
Groupie


Joined: 09 November 2003
Status: Offline
Points: 84
Post Options Post Options   Thanks (0) Thanks(0)   Quote robs Quote  Post ReplyReply Direct Link To This Post Posted: 13 March 2004 at 2:20pm

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.

 

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.