wxMax context menu - getting started
BlitzMax Forums/Brucey's Modules/wxMax context menu - getting started
| ||
Hi, I want to create a wxGenericDirCtrl with a popmenu if a file is right clicked. In this thread, in the TestPopups.bmx, the needed informations seem to be created by wxcodegen. How do I setup the needed informations in formbuilder; or do I have to do it myself like in samples/menu.bmx? Hints appreciated. |
| ||
Ideally the right-button down needs to be attached to the embedded treectrl. Unfortunately, the default treectrl won't be available to the BlitzMax event system. I'll need to apply some changes which should fix that. After that, you will be able to use GetTreeCtrl() to get a handle on the control, to which you connect the event you want. Watch this space :-) |
| ||
Watch this space :-) I am not in hurry. *refresh* *refresh* *refresh* ... |
| ||
Okay... it's looking better. I've added a small "genericdirctrl" sample to show how to access the internal tree ctrl and adding your own event-processing to it. Let me know if that's enough access to it. :o) |
| ||
Hi Brucey, because I found no better solution I edited the codegen.bmx. Is there a way around this? I've tried to insert your code and see no really difference between mine and your sample. But your works, and mine not (no right mouseclick detected). viewer.bmx Viewercodegen.bmx: |
| ||
In your Myworkframe type, you are overriding the Onrightclick method of Base, which means that is called, and not the one which outputs the text... comment it out, and all should be well ;-) |
| ||
because I found no better solution I edited the codegen.bmx. Is there a way around this? Yes, there should be. You can add the treectrl specific code in the OnInit() method of your subclassed type. This bit : Local tree:wxTreeCtrl = m_genericDirCtrl1.GetTreeCtrl() tree.Connect(tree.GetId(), wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, _OnRightClick, Null, Self) You should call Super.OnInit() first... Method OnInit() Super.OnInit() Local tree:wxTreeCtrl = m_genericDirCtrl1.GetTreeCtrl() tree.Connect(tree.GetId(), wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, _OnRightClick, Null, Self) End Method |
| ||
Ah, super.OnInit(). Is there a smile for enlightment? *:-) perhaps? Thanks a lot, finally got it working. |