ToolbarButton width

  1. 4 days ago

    Michelle M

    Jun 29 Preston, UK


    There doesn't seem to be any way I can easily get the width of a ToolbarButton on a Toolbar.

    Is there some funky way to calculate it somehow, or something I've missed?

    My app is just a toolbar that needs to resize to fit all buttons on, so settings the window width to the sum of all the ToolbarButton widths would be ideal.

  2. Beatrix W

    Jun 29 Testers, Third Party Store Europe (Germany)

    macOS does that on its own. You get arrows when the toolbar is too wide for the window. Except for macOS BS and that only in my app and not in an example.

  3. Michelle M

    Jun 29 Preston, UK

    I need to make my window automatically wider so all toolbar buttons all fit on, I don't want the >> button to have to appear. But I'm not sure if it's possible to calculate the width somehow.

  4. Can you not use the following code to determine the screen width or height :

    self.intScreen_W = Screen(0).Width
    self.intScreen_H = Screen(0).Height

    Screen(0).Width is referring to the main screen width. if you know the screen width, the number of icons on your toolbar and space in between, you can calculate the width and height of your toolbar icons. But maybe I am misunderstanding your problem.

    I hope you find a solution soon.


  5. Beatrix W

    Jun 30 Testers, Third Party Store Europe (Germany)

    Then I'd recommend using your own toolbar where you have control.

or Sign Up to reply!