Print Page | Close Window

QUESTION: Disable ContextMenu on string items

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=14007
Printed Date: 27 November 2024 at 11:32am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: QUESTION: Disable ContextMenu on string items
Posted By: Aaron
Subject: QUESTION: Disable ContextMenu on string items
Date Posted: 14 April 2009 at 10:17am
Hi,
 
Is there a way to disable contextmenu when right clicking string item? Any help would be appreciated
 
Thanks a lot in advance
 
 


-------------
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....



Replies:
Posted By: jpbro
Date Posted: 14 April 2009 at 2:19pm
The only method I found was to subclass the WM_CONTEXTMENU message of the EditHwnd during the RequestEdit event. I think CJ will have to add a property to make this easier, unless I missed something.

-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Aaron
Date Posted: 15 April 2009 at 5:57am
Hi Jason,
 
Thanks for reply. If I would subclass the WM_CONTEXTMENU message, would it be possible to change the captions of buttons (Copy,Paste etc etc)?
 
I'm asking this because I need to change application language during runtime. All works OK except for rightclicking a property string and SystemMenu (I was hoping on Oleg 's reply in some CommandBars subforum )
 
Thanks a lot
 
 


-------------
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: jpbro
Date Posted: 15 April 2009 at 11:10am
Hi Aaron,

You can create a completely custom menu using the CommandBars control (for example) and show that in place of the default context menu. I've put together a sample app here:

uploads/20090415_110906_SubclassPropert.zip - uploads/20090415_110906_SubclassPropert.zip

Using this method, showing just about any kind of context menu should be possible. The unfortunate side-effect is subclassing in the IDE is no fun, but there are safe-subclassing libraries out there you can use to make life easier.



-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Aaron
Date Posted: 16 April 2009 at 4:57pm
Hi Jason,
 
Thanks a lot for sample project  It's a nice option to have but I have to know if this is a "safe" way of doing this? Do you use this code yourself?
I hope you are using it  If so, I have only the system menu to worry about, but maybe CJ has an alternative...
 
Thank you
 
 
 


-------------
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: jpbro
Date Posted: 17 April 2009 at 11:35am
Hi Aaron, the code is "safe" in the sense that it will work perfectly in your compiled EXE. It is "unsafe" in the sense that you can't break your program execution in the IDE to debug while the subclasser is active (when the edit window is visible), because it will crash the VB6 IDE. There are subclassing DLLs out there that prevent this problem, but then you add a dependency to your distribution. In any case, a CJ alternative (such as a UseDefaultContextMenu property) would be ideal.

-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Aaron
Date Posted: 18 April 2009 at 5:28am
Hi Jason,
 
I know the "downside" of subclassing,  that's why I minimize the use...  But in my case I have to do something, it doesn't look great when all my strings have translations of selected language and Popupmenu items aren't translated :( 
I really want to make this work so I can select different languages during runtime.
 
Maybe CJ will take care of this and create property for ContextMenu, would be nice option to have
 
btw I also tried your code with wndReportControl.InplaceEditHwnd but this doesn't work as with PropertyGrid control ?!?
 
Thanks again
 


-------------
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: Aaron
Date Posted: 26 April 2009 at 11:05am
Hi,
 
Will this be possible in future release / ever?
 
Thank you
 
 


-------------
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: JantjeKeizer
Date Posted: 27 April 2009 at 7:05am
You can use http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=68737&lngWId=1 - this for IDE safe subclassing


Posted By: jpbro
Date Posted: 27 April 2009 at 12:38pm
Originally posted by Aaron Aaron wrote:

btw I also tried your code with wndReportControl.InplaceEditHwnd but this doesn't work as with PropertyGrid control ?!?


Sorry Aaron, I missed the part of your post that said it doesn't work with the ReportControl...I'll take a look and see if I can get it working.


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: jpbro
Date Posted: 27 April 2009 at 12:41pm
Try this:


Private Sub ReportControl1_BeginEdit(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem)
   HookContextMenu Me.ReportControl1.InplaceEditHwnd
End Sub

Private Sub ReportControl1_EditCanceled(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem)
   UnhookContextMenu
End Sub


Seems to work here.


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Aaron
Date Posted: 27 April 2009 at 1:51pm
Hi Jason,
 
Thanks for checking this  I am sure I did the same as you suggested (I had still the events showing in my test project) and it didn't work. Well I tried again and it works same way as with PropertyGrid control.
 
Thanks again.
 
 
 


-------------
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