Script to make a toolbar button to turn on and off graph builder fit to windowHey everyone,
I was wondering if someone could help me out with a script that I could assign to my toolbar so that I could "one click" turn graph builders "Fit to Window" options on and off

So if it I clicked it and the current selection was "Auto/On/MAR" then it would set Fit to Window to "Off" and if the current section was "Off" then it would set Fit to Window to "On".
Thanks for any input on how to do this!
Steve
Automation and ScriptingRe: Script to make a toolbar button to turn on and off graph builder fit to windowI'm not sure if there is any direct message to get the current Fit To Window setting, but something like this might work
Names Default To Here(1);
gb_ref = (Current Report() << XPath("//OutlineBox[@helpKey = 'Graph Builder']"))[1] << Get Scriptable Object;
cur_stretch = All(gb_ref << Get Auto Stretching);
If(cur_stretch,
gb_ref << Fit to Window("Off")
,
gb_ref << Fit to Window("On")
);Re: Script to make a toolbar button to turn on and off graph builder fit to windowLooks like that worked! Thanks a ton.
One last little ask, what would need to be added to the current state to the subtitle? So something like this?

Re: Script to make a toolbar button to turn on and off graph builder fit to windowNot sure if it has any specific message either, but you can try to find the text edit box (this isn't the most robust option but should work in simple cases)
Names Default To Here(1);
gb_ref = (Current Report() << XPath("//OutlineBox[@helpKey = 'Graph Builder']"))[1] << Get Scriptable Object;
cur_stretch = All(gb_ref << Get Auto Stretching);
fit_state = If(cur_stretch, "Off", "On");
gb_ref << Fit to Window(fit_state);
Report(gb_ref)[GraphBuilderTitleBox(2), TextEditBox(1)] << Set Text(Eval Insert("FTW = ^fit_state^"));
If you want to make sure that the subtitle is visible you can add
gb_ref << Show Subtitle(1);
to end
Re: Script to make a toolbar button to turn on and off graph builder fit to windowYou rock Jarmo, thanks for all the great help (as usual)!
Steve