Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

wxKeyBinder Plugin

(1/2) > >>

Pecan:
I now have a working adaptation of wxKeyBinder as a C::B plugin.
However, I have a problem with the iniitial key bindings made to the menus.

After C::B loads the plugin, (I name it zcbKeyBinder so its loaded last), the
bindings show in the menu labels, but the keys don't execute. I have to
re-bind the keys at least once in the BuildModuleMenu call. Then all is
fine until the next time C::B is loaded.

Question 1:
What is C::B doing  with the menu's after loading the last plugin?

Question 2:
How can I preserve the key binding made at the BuildMenu call.

Yes, I know I could read the code, but... guys, just a little help here. :mrgreen:

Thanks
Pecan


thomas:
The menu is rebuilt from scratch many many times, so the only way to have something persisitent is to do it every time inside Build(Module)?Menu. This is true for any menu items that you add as well for any changes that you make to existing menu items.

Regarding wxKeyBinder, you may want to know that it is becoming a part of the main application.

Pecan:
Thanks thomas

Knowing its on the way will save me a lot of time.
I've worked another 6 hours finding out that wxKeyBinder is
not happy with frames poping in and out of existence like Love and Charm.
It was attempting to delete EvtHandlers when the window/frame was
long gone.

I've actually got it working though. But will wait for the professional
C::B version.

As for re-scanning the menus (from a plugin): wxKeyBinder had attached
EvtHandlers to a memorized windows list. As a plugin wxKeyBinder code has
 no way of knowing that a window has disappeared.
The only event it can know, is that the user has hit the context menu.

Just academically, how would you solve the problem of a plugin needing
to know about window events (not just context key events?)

Thanks
Pecan

thomas:
PushEventHandler would probably do you, but you can very easily mess up the application if you play with that, so handle with care.

Pecan:
Thanks thomas

To the "would-be" cbKeyBinder plugin I had planned to add another
wxCmd type such that a key could be defined in terms of other keys,
(a key macro).  Something like "Ctrl+Enter = {End}{Enter}{Tab}{Tab} ".
One of my favorite macros. :P

It looks like the existing wxKeyBinder structure AND the built-in dialog can
handle both the current menu key capability plus a macro facility.

Will the C::B internal version of wxKeybinder have this capability or
would it be worth my persueing.

BTW, is it worth releasing my cbKeyBinder as a stop-gap measure or
will the C::B KeyBinder be released soon?

Just looking for something useful and fun to do while learning C::B and wxWidgets.

thanks
Pecan

Navigation

[0] Message Index

[#] Next page

Go to full version