Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Property Grid
  New Posts New Posts RSS Feed - QUESTION: Disable ContextMenu on string items
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

QUESTION: Disable ContextMenu on string items

 Post Reply Post Reply
Author
Message
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 Topic: QUESTION: Disable ContextMenu on string items
    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....
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

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: 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....
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

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

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: 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....
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

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: 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....
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: 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....
Back to Top
JantjeKeizer View Drop Down
Groupie
Groupie


Joined: 12 February 2008
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote JantjeKeizer Quote  Post ReplyReply Direct Link To This Post Posted: 27 April 2009 at 7:05am
You can use this for IDE safe subclassing
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

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