11-08-2024, 01:09 PM
Toolbar button text can be changed after creating the toolbar, but need a workaround.
using Au.Triggers;
ActionTriggers Triggers = new();
Triggers.Options.ThreadOfTriggers();
Triggers.Window[TWEvent.VisibleOnce, "LibreAutomate", flags: TWFlags.RunAtStartup] = _Toolbar;
Triggers.RunThread();
void _Toolbar(WindowTriggerArgs ta) {
toolbar t = new("sgcqjw8d6dw", TBCtor.DontSaveSettings) { ActionThread = false };
t["Aaaaa"] = o => { };
TBItem menuButton = null;
menuButton = t.Menu("Bbbbb", m => {
m["Change button text"] = o => {
menuButton.Text = "New longer text";
t.DisplayText ^= true; t.DisplayText ^= true; //a workaround to remeasure and redraw the toolbar
};
});
t["Cccc"] = o => { };
t.Show(ta);
}