- AuthorPosts
- March 21, 2011 at 1:09 pm #9315ToadLoadinMember
Hi,
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? :-)
March 21, 2011 at 3:07 pm #9316webernMemberTo toggle Line Numbers via a macro you can use just this command alone:
editor.ExecuteCommandByID(4530);March 21, 2011 at 3:57 pm #9317Yutaka EmuraKeymasterHi 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.
March 22, 2011 at 8:57 am #9318ToadLoadinMemberThank you webern and Yutaka! :-D
March 23, 2011 at 5:06 am #9319ToadLoadinMemberHi Yutaka,
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.
March 23, 2011 at 5:39 am #9320Yutaka EmuraKeymasterHi ToadLoadin,
You should write like this:
function toggleLineNum() {
var cfg = document.Config;
var isLineNumOn = cfg.General.ShowLineNumbers;
cfg.General.ShowLineNumbers = !isLineNumOn;
cfg.Save();
}March 23, 2011 at 8:03 am #9321ToadLoadinMemberYes, 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();
} - AuthorPosts
- You must be logged in to reply to this topic.