Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Redraw of MenuItem in open toolbar
#2
Toolbar button text can be changed after creating the toolbar, but need a workaround.

Code:
Copy      Help
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);
}


Messages In This Thread
RE: Redraw of MenuItem in open toolbar - by Gintaras - 11-08-2024, 01:09 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)