I am trying to write a small Lua script that will allow keystrokes to replace mouse clicks to switch a panel clock between 'Clock' mode and 'Timer' mode. Here is a small section of the original XML code:
The first code line above ends up as a tool tip displaying either Mode Selector(Clock) or Mode Selector(Timer) depending on the value of Lvar L:ClockLc2Mode. The problem is that my Lua script can't access L:ClockLc2Mode until the tool tip is made to appear by hovering the mouse over the clock Mode button. Any attempt to write or read L:ClockLc2Mode to determine what mode the clock is currently in returns a nil value until the tool tip has been displayed (I thought Lvars where initialized to 0 by the sim). So what I don't understand is how the first line of code is involved with making L:ClockLc2Mode accessible. I can't find the tool tip code in any of the XML files so I assume it is tucked away in one of the dlls or the model file.
Thanks for any ideas.
Al
Code:
Mode selector(%((L:ClockLc2Mode,bool))%{if}Timer%{else}Clock%{end})
(M:Event) 'LeftSingle' scmp 0 == if{(L:ClockLc2Mode,bool ) ! (>L:ClockLc2Mode,bool)
1 (>L:ClockLc2MiddleSwitch,bool) }
(M:Event) 'LeftRelease' scmp 0 == if{ 0 (>L:ClockLc2MiddleSwitch,bool) }
The first code line above ends up as a tool tip displaying either Mode Selector(Clock) or Mode Selector(Timer) depending on the value of Lvar L:ClockLc2Mode. The problem is that my Lua script can't access L:ClockLc2Mode until the tool tip is made to appear by hovering the mouse over the clock Mode button. Any attempt to write or read L:ClockLc2Mode to determine what mode the clock is currently in returns a nil value until the tool tip has been displayed (I thought Lvars where initialized to 0 by the sim). So what I don't understand is how the first line of code is involved with making L:ClockLc2Mode accessible. I can't find the tool tip code in any of the XML files so I assume it is tucked away in one of the dlls or the model file.
Thanks for any ideas.
Al
Last edited:






