SlickEdit Product Discussion > Slick-C® Macro Programming
am I in an edit buffer?
(1/1)
mcarlson:
I apologize now for not knowing the correct SlickEdit/Slick-C terminology.
I will try to use SE terms as I learn them.
I want a macro to be able to differentiate between focus being in a buffer, and focus being on a command line.
By command line I mean the prompt that I get after type "Esc x" (gnu emacs mode), or the 'edit' file open prompt "Ctrl-x Ctrl-f" (gnu emacs mode).
What can I look at to differentiate these two states?
Thank you,
Matt
hs2:
I'm using this in various macros:
--- Code: --- cmdline_active := (_cmdline == p_window_id);
// e.g. edit fields in dialogs
in_text_box := (p_object == OI_TEXT_BOX);
--- End code ---
HS2
mcarlson:
I've added both of the lines that HS2 suggested and I'm checking them using the debugger.
It seems that they are the same if the _command is invoked either from a keybinding with a buffer focused or from a keybinding with a command line focused.
I'm realizing while writing this that the fact that it's called from a keybinding may have something to do with what I'm seeing, and was probably an important piece of information.
I also found and tried to use command_state() with the same effect (no change, if focus is on buffer or command line)
I did notice however that "edit" gives a different response (it doesn't call my macro from the keybinding).
Thanks again for all the help.
Matt
MindprisM:
I just got done dealing with this weirdness.
command_state() lies to you if your _command does not have name_info(','VSARG2_CMDLINE|VSARG2_ICON|VSARG2_REQUIRES_EDITORCTL|VSARG2_READ_ONLY)
in particular the VSARG2_CMDLINE
Ken_M:
Thanks! I was going crazy as to why it wasn't working for me.
Navigation
[0] Message Index
Go to full version