Author Topic: wxKeyBinder Plugin  (Read 7470 times)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
wxKeyBinder Plugin
« on: November 11, 2005, 01:14:30 am »
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



Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: wxKeyBinder Plugin
« Reply #1 on: November 11, 2005, 10:36:03 am »
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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: wxKeyBinder Plugin
« Reply #2 on: November 11, 2005, 03:26:17 pm »
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

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: wxKeyBinder Plugin
« Reply #3 on: November 11, 2005, 04:02:58 pm »
PushEventHandler would probably do you, but you can very easily mess up the application if you play with that, so handle with care.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: wxKeyBinder Plugin
« Reply #4 on: November 11, 2005, 04:20:08 pm »
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

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: wxKeyBinder Plugin
« Reply #5 on: November 11, 2005, 05:54:33 pm »
Hmm... I don't see how the wxKeyBinder dialog allows you to enter a kind of macro. It only seems to have menu entries there.

If you have a plugin working for RC2, then of course feel free to release it.

It is just that you should be aware of possible conflicts in the future, which is why I was telling you. I don't know what happens (and probably don't want to know either) when two instances of wxKeyBinder are running.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."