Toggling Line Number via Macro?
Hi,
I want to toggle line number on/off via macro, so I wrote this function:
But nothing chages while invoking this function, any advice? :-)
I want to toggle line number on/off via macro, so I wrote this function:
function toggleLineNum() {
var isLineNumOn = document.Config.General.ShowLineNumbers;
document.Config.General.ShowLineNumbers = !isLineNumOn;
}But nothing chages while invoking this function, any advice? :-)
To toggle Line Numbers via a macro you can use just this command alone:
editor.ExecuteCommandByID(4530);
editor.ExecuteCommandByID(4530);
Hi ToadLoadin,
This is a frequently asked question. Please use Save() when you finished settings:
Of course, you can use the EmEditor command "Line Number", and there is a toolbar button for this command.
This is a frequently asked question. Please use Save() when you finished settings:
cfg = document.Config;
/// do something
cfg.Save();
Of course, you can use the EmEditor command "Line Number", and there is a toolbar button for this command.
Thank you webern and Yutaka! :-D
Hi Yutaka,
I rewrote my function to this:
but it still does not work... :-(
I rewrote my function to this:
function toggleLineNum() {
var cfg = document.Config;
var isLineNumOn = document.Config.General.ShowLineNumbers;
document.Config.General.ShowLineNumbers = !isLineNumOn;
cfg.Save();
}but it still does not work... :-(
Yutaka wrote:
Hi ToadLoadin,
This is a frequently asked question. Please use Save() when you finished settings:
cfg = document.Config;
/// do something
cfg.Save();
Of course, you can use the EmEditor command "Line Number", and there is a toolbar button for this command.
Hi ToadLoadin,
You should write like this:
You should write like this:
function toggleLineNum() {
var cfg = document.Config;
var isLineNumOn = cfg.General.ShowLineNumbers;
cfg.General.ShowLineNumbers = !isLineNumOn;
cfg.Save();
}Yes, it works! Thank you! :-D
Yutaka wrote:
Hi ToadLoadin,
You should write like this:
function toggleLineNum() {
var cfg = document.Config;
var isLineNumOn = cfg.General.ShowLineNumbers;
cfg.General.ShowLineNumbers = !isLineNumOn;
cfg.Save();
}
7 posts in this topic