Toolbar in Panel Title

  1. #1

    Toolbar in Panel Title

    Hello,

    Different type of panels have Title Bar.
    Panel constructor has Tools property (type of List<Tool>).
    I tried different ways to add a button in code behind to the Title of a GridPanel:
    new GridPanel { Title="My Grid", Tools = new List<Tool>() {...
    But nothing worked.

    Can you please give an example?

    Thanks,

    Vadim
  2. #2
    Hello @VADIM!

    Setting the tools as a list of Tool objects should be correct. Declaring the list of tools, instead of ... as the following:

    new List<Tool>()
    {
        new Tool()
        {
            Type = ToolType.Gear,
            Tooltip = "Settings",
            Callback = new JsFunction("Ext.toast('Adjust settings');")
        },
        new Tool()
        {
            IconCls = "x-fa fa-reply-all", // From font-awesome (https://fontawesome.com/cheatsheet)
            Tooltip = "Reply",
            Callback = new JsFunction("Ext.toast('Reply report');")
        },
        new Tool()
        {
            IconCls = "x-md md-icon-add-shopping-cart", // From material icons (https://fonts.google.com/icons?selected=Material+Icons)
            Tooltip = "Add to cart",
            Callback = new JsFunction("Ext.toast('Add it to cart');")
        }
    }
    Works for me.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3

    Works fine

    Thanks Fabricio,

    Your solution works great as always.
    However tools not always can replace buttons.
    When operation is no so obvious a button with text and icon could be more helpful.
    I would say in 90% of the cases tools are good enough.

    Vadim
  4. #4
    Hello again, @VADIM!

    Thanks for the feedback, and yes, the title bar buttons are not meant to 100% replace buttons, as they have limited functionality and different visual effects. If a full button is necessary, a toolbar would probably be your best bet.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Exactly.
    That's what I do.

    Thanks again!
    Vadim

Similar Threads

  1. [CLOSED] Viewport --> (Toolbar + Panel) --> (Toolbar + Control)
    By Mario in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Oct 15, 2014, 2:51 PM
  2. Panel title click
    By elector in forum 2.x Help
    Replies: 4
    Last Post: Jul 17, 2014, 6:56 AM
  3. Replies: 7
    Last Post: Nov 13, 2011, 4:43 PM
  4. [CLOSED] Toolbar on panel title
    By jeybonnet in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 07, 2011, 3:05 PM
  5. Panel - Collapsed Title?
    By Tbaseflug in forum 1.x Help
    Replies: 5
    Last Post: Jan 21, 2009, 9:35 AM

Posting Permissions