Print Page | Close Window

SOLVED: Respond to Context Menu

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=11984
Printed Date: 21 May 2024 at 2:50pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: SOLVED: Respond to Context Menu
Posted By: WaleedSeada
Subject: SOLVED: Respond to Context Menu
Date 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



Replies:
Posted By: Oleg
Date Posted: 27 August 2008 at 3:58am
Hi,
 
Add Execute event handler.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: WaleedSeada
Date 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


Posted By: Aaron
Date 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 - 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....


Posted By: WaleedSeada
Date 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


Posted By: Aaron
Date 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....


Posted By: WaleedSeada
Date 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


Posted By: Oleg
Date 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


Posted By: WaleedSeada
Date 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


Posted By: Aaron
Date 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....


Posted By: WaleedSeada
Date 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


Posted By: Aaron
Date 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....


Posted By: WaleedSeada
Date 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


Posted By: Aaron
Date 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....



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net