Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - SOLVED: Respond to Context Menu
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SOLVED: Respond to Context Menu

 Post Reply Post Reply
Author
Message
WaleedSeada View Drop Down
Groupie
Groupie
Avatar

Joined: 29 March 2007
Location: Egypt
Status: Offline
Points: 88
Post Options Post Options   Thanks (0) Thanks(0)   Quote WaleedSeada Quote  Post ReplyReply Direct Link To This Post Topic: SOLVED: Respond to Context Menu
    Posted: 27 August 2008 at 3:39am
Dear all,
 
How to respond to Context Menu selection ...!!
 
Regards
 
:Powerbuilder 10.5
:Codejock suite 11.2.2
=========================
Waleed Seada
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 27 August 2008 at 3:58am
Hi,
 
Add Execute event handler.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
WaleedSeada View Drop Down
Groupie
Groupie
Avatar

Joined: 29 March 2007
Location: Egypt
Status: Offline
Points: 88
Post Options Post Options   Thanks (0) Thanks(0)   Quote WaleedSeada Quote  Post ReplyReply Direct Link To This Post Posted: 27 August 2008 at 4:31am
Hi Oleg,
 
Could You elaborate more, an example will be great ...
 
Actually, I added an event handler to the commandbar execute event, and it works for all toolbar buttons, but for the context it sometimes fire and sometimes not ...!!
 
regards
:Powerbuilder 10.5
:Codejock suite 11.2.2
=========================
Waleed Seada
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 27 August 2008 at 5:09am
Hi,
 
Did you create your menu in code or did you just dropped a Commandbars control and let CB create the menu for you?
 
I did the last option and found there are a couple of strange things happening see my post: https://forum.codejock.com/forum_posts.asp?TID=11986
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
WaleedSeada View Drop Down
Groupie
Groupie
Avatar

Joined: 29 March 2007
Location: Egypt
Status: Offline
Points: 88
Post Options Post Options   Thanks (0) Thanks(0)   Quote WaleedSeada Quote  Post ReplyReply Direct Link To This Post Posted: 27 August 2008 at 5:32am
Hello Aaron,
 
I create the full Context Menu in Code ...
Is it cona be different to create those context as popup menus in the Active menubar itself ??? I 'll give it a try ....
 
Best,
 
:Powerbuilder 10.5
:Codejock suite 11.2.2
=========================
Waleed Seada
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 27 August 2008 at 5:55am

Hi,

Yes, you can. I have a mainmenu with items, same items can be shown as toolbar and/or context menu.  
 
Just call:
CommandBars.ActiveMenuBar.Controls(ID_POPUP_CONTROL).CommandBar.ShowPopup
 
for showing contextmenu
 
Just call:
CommandBarsViewEditor.ActiveMenuBar.Controls(ID_POPUP_CONTROL).CommandBar.SetTearOffPopup "Caption of toolbar", SOME_ID, 500
           
for possibility to tearoff toolbar
 
 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
WaleedSeada View Drop Down
Groupie
Groupie
Avatar

Joined: 29 March 2007
Location: Egypt
Status: Offline
Points: 88
Post Options Post Options   Thanks (0) Thanks(0)   Quote WaleedSeada Quote  Post ReplyReply Direct Link To This Post Posted: 27 August 2008 at 6:26am
Hello All,
 
I try the Popup Menu it works fine as Popup menu up in the active menu bar, but not as Context Menu, Still behave the same .... !!!
 
Funny, isn't it ....
 
Ideas ......
 
/Edit:
 
Thanks Aaron they both works fine ...
CommandBars.ActiveMenuBar.Controls(1).CommandBar.ShowPopup()
&
CommandBars.ActiveMenuBar.Controls(1).CommandBar.SetTearOffPopup("Tree Options", 20000, 500)
 
It is strange that the Context Menu is not behaving the same !!!
 
Not a problem as long as It surve the purpose, right ...
 
Thanks again Aaron.
 
:Powerbuilder 10.5
:Codejock suite 11.2.2
=========================
Waleed Seada
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 27 August 2008 at 8:29am
Hi,
 
try not specify x and y to allow commandbars use cursor coordintes. guess problem in your calculation fo these x and y.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
WaleedSeada View Drop Down
Groupie
Groupie
Avatar

Joined: 29 March 2007
Location: Egypt
Status: Offline
Points: 88
Post Options Post Options   Thanks (0) Thanks(0)   Quote WaleedSeada Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2008 at 5:02am
Dear All,
 
I am doomed !!!
 
The Popup menu solution to be used as context menu has been successful so far, until I decided to hide the Active menu bar....
 
I can't used the popup menus anymore ...
 
any ideas, I am ... doomed
 
Best regards,
 
:Powerbuilder 10.5
:Codejock suite 11.2.2
=========================
Waleed Seada
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2008 at 5:34am
Hi,
 
I justed tested this and it works with STANDARD VB MENU  So I expect... it should be working when creating a menu in code.
 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
WaleedSeada View Drop Down
Groupie
Groupie
Avatar

Joined: 29 March 2007
Location: Egypt
Status: Offline
Points: 88
Post Options Post Options   Thanks (0) Thanks(0)   Quote WaleedSeada Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2008 at 6:00am

Hello Aaron,

I used this code: CommandBars.ActiveMenuBar.Visible = False

when I rightclick on any control I got an empty Menu (small Gray box)
 
If I put it back to True, I can ....
 
what is the problem the Menubar can be exist but not visible, right ...
 
Best regards
:Powerbuilder 10.5
:Codejock suite 11.2.2
=========================
Waleed Seada
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2008 at 6:29am
Hi,
 
Yes it should be. Do you create contextmenu in code as well? Or create it when necessary? If you do, try to loop Commandbar.Controls collection and check if there are any...
 
 
 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
WaleedSeada View Drop Down
Groupie
Groupie
Avatar

Joined: 29 March 2007
Location: Egypt
Status: Offline
Points: 88
Post Options Post Options   Thanks (0) Thanks(0)   Quote WaleedSeada Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2008 at 8:47am
Hello Aaron,
 
I don't use context Menus, I used the Popup menu from the one attahced to the ActiveMenuBar.
 
and it is created in code ...
 
regards,
 
:Powerbuilder 10.5
:Codejock suite 11.2.2
=========================
Waleed Seada
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2008 at 9:10am
Hi,
 
You can also copy buttons into your popmenu and also check if they exist. I have only VB code to show you but maybe you understand it anyway.
 
Dim Control As CommandBarControl
Dim ContextControl As CommandBarControl
Dim Popup As CommandBar
        Set Control = CommandBars.ActiveMenuBar.FindControl(, ID_POPUPCONTROL)
        If Control Is Nothing Then Exit Sub
        Set Popup = CommandBars.Add("Popup", xtpBarPopup)
        For Each ContextControl In Control.CommandBar.Controls
            ContextControl.Copy Popup
        Next
        Popup.ShowPopup
 
 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
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.172 seconds.