Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Nuget] Toolbar does not show button tooltip
#1
Hi, I'm using nuget with C# console. I have setup like the example:
 
Code:
Copy      Help
public class ToolbarRunner
{
    [AttributeUsage(AttributeTargets.Method)] class TriggersAttribute : Attribute { }
    [AttributeUsage(AttributeTargets.Method)] class ToolbarsAttribute : Attribute { }

    ActionTriggers Triggers { get; } = new();

    public void Run()
    {
        RunTriggersAndToolbars();
    }

    void RunTriggersAndToolbars()
    {
        void _TriggerOptions(bool toolbars)
        {
        }

        foreach (var mi in typeof(ToolbarRunner).GetMethods(BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Instance))
        {
            bool tb = mi.IsDefined(typeof(ToolbarsAttribute), false);
            if (!(tb || mi.IsDefined(typeof(TriggersAttribute), false))) continue;

            Triggers.ResetOptions();
            _TriggerOptions(toolbars: tb);
            if (tb) Triggers.Options.ThreadThis();

            try { mi.Invoke(this, null); }
            catch (TargetInvocationException ex) { print.it(ex.InnerException); return; }
        }

        //run triggers in other thread, to avoid blocking hooks when getting icons etc
        Triggers.RunThread();
    }

    [Toolbars]
    void Toolbar_Floating_Triggers()
    {
        Toolbar_Floating();
    }

    void Toolbar_Floating()
    {
        var t = new toolbar();
        if (t.FirstTime)
        {
        }

        t["Example|EEEEEEEEE"] = o => { print.it("button clicked"); };
        t["Text\a"] = o => { }; //this button always displays text. The above button never.
        t.Menu("Menu1", t =>
        {
            t["A"] = o => { };
            t["B|Tooltip3"] = o => { };
        });
        t.Separator();
        t["Text2\a|Tooltip2"] = o => { };

        t.Show();
    }
}
And in my Program of Console app:
 
Code:
Copy      Help
new Thread(() =>
{
    new ToolbarRunner().Run();
}).Start();

Console.ReadLine();
The toolbar shows at the top-left corner of screen, but when hover on the button, tooltip does not show.
Any idea for this?
My appreciate.


Messages In This Thread
[Nuget] Toolbar does not show button tooltip - by darkraise - 08-30-2023, 07:06 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)