Author Topic: Key Bindings for recorded macros  (Read 7393 times)

jechard

  • Community Member
  • Posts: 15
  • Hero Points: 0
Key Bindings for recorded macros
« on: October 05, 2010, 05:30:23 PM »
Recorded a macro in core and then manually edited it to add some functionality that was missing.  I was able to get it running and bound to a key.  I copied that macro 2x and renamed the new ones and changed the bodies within the macros.  I was able to bind a key to the second macro, but not to the third one.  The code for the macros is attached, and the macros all function if they are executed from the macro list.  I mapped the first function to Ctrl+Alt+Home, the second to Ctrl+Alt+End and the third to Ctrl+Alt+PgDn.  I've tried mapping it to different key strokes and the same thing happens.  Any help would be appreciated.

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Key Bindings for recorded macros
« Reply #1 on: October 05, 2010, 10:12:00 PM »
Your code works for me and I can bind keystrokes to the three functions ok.
What version of slickedit are you using?

When you say "you can't bind a key to the third function"  - what exactly happens  - do you get an error message or what?  - try to describe exactly what happens.

Graeme

jechard

  • Community Member
  • Posts: 15
  • Hero Points: 0
Re: Key Bindings for recorded macros
« Reply #2 on: October 06, 2010, 11:57:26 AM »
Sorry.  I can bind keys to it, but nothing happens when they are bound.  I am running core 3.5.1 in the helios environment in windows.  This is in the C++ perspective with visual studio .net emulation.  When I bind the first two functions to the key bindings, they work perfectly.  When I bind the third one, it appears to work, but nothing happens when I click the combo.  However, should I leave my user macro file open, when I hit the key combo, it jumps to the beginning of the function that should be executing in the .e file.  I tried to debug it, but eclipse just hung up on me.  I unbound all of the functions, and tried different combinations and key combos all with the same result.  I even tried deleting some of the macros from my file.  Always with the same result.  It will run if I do it from the macros list, but won't function when I'm using key combinations.

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Key Bindings for recorded macros
« Reply #3 on: October 07, 2010, 10:41:45 AM »
oops, didn't notice you were using slickedit core for eclipse so I'm probably not the right person to help you.

Go_To_Next_Func is the function that doesn't work for you  - is that right?

Code: [Select]
_command Go_To_Next_Func() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_READ_ONLY|VSARG2_ICON|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   _macro('R',1);
   push_bookmark();
   next_proc();
}

What do you mean by "when I click the combo"?

If you type what-is on the slick command line, then enter the key combo that's supposed to be bound to Go_To_Next_Func, what does slick tell you the key is bound to?

There's a few other things you could try - like adding a fourth function to the file and see what works. Or move the function to some other file of your own.  Or add a fourth function and call Go_To_Next_Func from that.  Or try binding a simple function key temporarily, instead of a key combo.  Do you know about the say function  - if you add say("hello"); to your code, it will output hello to a debug dialog window (at least it does in slickedit for Windows).  You can sort of trace your code that way.

Graeme

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Key Bindings for recorded macros
« Reply #4 on: October 07, 2010, 10:48:49 AM »
It seems Ryan posted the following but I don't see it in the forum so just in case you haven't seen it - here it is

Quote
In Core, by default, you can't bind Ctrl + Alt + PgDn/PgUp to commands because they are handled differently in order to allow the normal SWT events for those key bindings, which are to switch buffers.  This behavior is controlled by a def var, which you can disable if you want to be able to bind these specific key bindings to commands.  Go to Macro > Set Macro Variable and for the variable enter def_eclipse_switchbuf and set the value to 0.

jechard

  • Community Member
  • Posts: 15
  • Hero Points: 0
Re: Key Bindings for recorded macros
« Reply #5 on: October 07, 2010, 11:55:45 AM »
It seems Ryan posted the following but I don't see it in the forum so just in case you haven't seen it - here it is

Quote
In Core, by default, you can't bind Ctrl + Alt + PgDn/PgUp to commands because they are handled differently in order to allow the normal SWT events for those key bindings, which are to switch buffers.  This behavior is controlled by a def var, which you can disable if you want to be able to bind these specific key bindings to commands.  Go to Macro > Set Macro Variable and for the variable enter def_eclipse_switchbuf and set the value to 0.


Right on Graeme!  I had tried different variations with the PgDwn button with no success.  I thought I had tried stuff without the PgDwn button but clearly did not.  Mapped to a different set of keys and it worked brilliantly.

Thanks!