Author Topic: [Bug] KeyBinder loses user-defined Tools shortcuts  (Read 4993 times)

tobiaslohe

  • Guest
[Bug] KeyBinder loses user-defined Tools shortcuts
« on: January 30, 2007, 11:45:35 pm »
Hi,

I got the following problem using the 20070130 and 20070123 snapshot on Windows XP:

I defined two tools and assigned shortcuts using Settings->Editor->Keyboard Shortcuts. Next time I started Code::Blocks the first shortcut disappeared and after the next restart both shortcuts were no longer assigned. This is reflected in the cbKeyBinder10.ini file, where the related entries disappear too.

I also tried to assign only one shortcut to one tool, but this shortcut was lost after re-start too.

Assigning shortcuts to other menu items like Help->Tips works perfectly.

So there seems to be a problem with shortcuts assigned to user-defined tools and strangely only one of those shortcuts seems to disappear each time Code::Blocks is started.

Thanks in advance for your help!
Tobias

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: [Bug] KeyBinder loses user-defined Tools shortcuts
« Reply #1 on: January 31, 2007, 02:21:49 pm »
Hi,

I got the following problem using the 20070130 and 20070123 snapshot on Windows XP:

I defined two tools and assigned shortcuts using Settings->Editor->Keyboard Shortcuts. Next time I started Code::Blocks the first shortcut disappeared and after the next restart both shortcuts were no longer assigned. This is reflected in the cbKeyBinder10.ini file, where the related entries disappear too.

I also tried to assign only one shortcut to one tool, but this shortcut was lost after re-start too.

Assigning shortcuts to other menu items like Help->Tips works perfectly.

So there seems to be a problem with shortcuts assigned to user-defined tools and strangely only one of those shortcuts seems to disappear each time Code::Blocks is started.

Thanks in advance for your help!
Tobias


Sorry, but the menu Tools items are rebuilt by CB each time a change is made. So any key you assign will be wiped out by the next Tools change.

I'll think about a way to solve this, but I haven't come up with a solution in a year. So, my being dense, there may not be a forthcomming fix.

There is a cludge workaround. First, make all the changes to the Tools menu. Wait 15 seconds. Then add the hotkeys to the menu items. Wait another 15 seconds. Close CB.

When you restart CB, the hotkeys should show until the next change you make to the Tools menu or until another plugin is enabled/disabled. (CB rebuilds all menu items when a plugin is enabled/disabled)

Why 15 seconds? KeyBinder scans all menu items every 15 seconds to see if CB or a plugin has change any keys. It then writes them to the cbKeyBinder10.ini file.

You might consider using KeyMacs in this case. A KeyMac like "!TC" (Alt-Tools-Config) with your chosen hotkey will not be wiped out. And it will be rebuilt each time CB rebuilds its menu system.

Another KeyMac like: "!T{DOWN}{DOWN}{ENTER}" would actual execute the second item on the Tools menu.

« Last Edit: January 31, 2007, 02:34:20 pm by Pecan »

tobiaslohe

  • Guest
Re: [Bug] KeyBinder loses user-defined Tools shortcuts
« Reply #2 on: January 31, 2007, 06:30:53 pm »
There is a cludge workaround. First, make all the changes to the Tools menu. Wait 15 seconds. Then add the hotkeys to the menu items. Wait another 15 seconds. Close CB.

When you restart CB, the hotkeys should show until the next change you make to the Tools menu or until another plugin is enabled/disabled. (CB rebuilds all menu items when a plugin is enabled/disabled)


Sorry, but that did not work.

Using KeyMacs sounds good, but when I open the KeyMacs.cbp (on Windows), I get the message, that compiler variables cb and wx are not defined, and I have no idea how to define them and assume that I need the source code of Code::Blocks and wxWidgets to be able to compile the plugin and well ...

I would directly use it if there is a dll I just copy to the plugin directory, or at least a detailed instruction how to compile it.

Just in the case this sounded a bit rude: I'm really thankful for your help!

Cheers Tobias

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: [Bug] KeyBinder loses user-defined Tools shortcuts
« Reply #3 on: January 31, 2007, 07:19:27 pm »
Currently KeyMacs requires SVN source and WxWidgets lib to compile.
I'll speak to the devs to see if it can be included in the contrib.