Add a new line to the command line "silently" (i.e., without printing to history)
gsb
I would prefer to have a hotkey that inserts a new line (e.g., return with the control key down), but I am unaware of a way to make a new hotkey that executes a function but does not also print to the command line. Printing to the command line is undesirable because one's location in the command window could change as a result. (If there was a built-in function like getCommandHistoryPosition() and setCommandHistoryPosition(), that location change could be dealt with, but I don't believe such a built-in function is available.)
//To use, run this function, newCommandLineLine_panel(). It will make a new window (which may be resized and moved as desired).
//A button with the label "nl" is created in the window. It will insert a new line into the command line when pressed
//(by calling the second function, newCommandLineLine)
function newCommandLineLine_panel()
newpanel/N=commandLineLinePanel/K=1/W=(50,50,200,100);doupdate;
Button btn0 title="nl", proc=newCommandLineLine
end
//function called on button click
function newCommandLineLine(s) : ButtonControl
STRUCT WMButtonAction &s
if (s.eventcode == 1)
toCommandLine "\r"
endif
end
//A button with the label "nl" is created in the window. It will insert a new line into the command line when pressed
//(by calling the second function, newCommandLineLine)
function newCommandLineLine_panel()
newpanel/N=commandLineLinePanel/K=1/W=(50,50,200,100);doupdate;
Button btn0 title="nl", proc=newCommandLineLine
end
//function called on button click
function newCommandLineLine(s) : ButtonControl
STRUCT WMButtonAction &s
if (s.eventcode == 1)
toCommandLine "\r"
endif
end
Forum
Support
Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More