Getting toolbar/toolbutton width - Mozilla
This is a discussion on Getting toolbar/toolbutton width - Mozilla ; Hello,
I'm working on a toolbar code in which users can add buttons into it.
I want to make it so that if adding a new button does not fit in the
available space, then a menuitem is inserted on ...
-
Getting toolbar/toolbutton width
Hello,
I'm working on a toolbar code in which users can add buttons into it.
I want to make it so that if adding a new button does not fit in the
available space, then a menuitem is inserted on a menu list at the
right. Same thing as the bookmarks toolbar in Firefox.
The buttons width is setup by Firefox based on the text entered by the
user.
I've been thinking on getting some code that can tell me the current
buttons width, so that I can calculate if another button will fit in
the space available, and if not then put it inside the menulist.
So far I haven't been able to read the buttons width
(toolbarbutton.width shows empty). Maybe there is even a better
approach than reading each button width and doing the calculation
myself.
I will appreciate any help or suggestion.
Regards,
Francisco
-
Re: Getting toolbar/toolbutton width
On 18 nov, 11:59, Neil Deakin wrote:
> fherrera wrote:
> > Hello,
>
> > So far I haven't been able to read the buttons width
> > (toolbarbutton.width shows empty). Maybe there is even a better
> > approach than reading each button width and doing the calculation
> > myself.
>
> You will want to get the actual width with getBoundingClientRect
>
> element.width returns the value of the width attribute and will return
> an empty value if it isn't set to anything.
>
> Neil
Thanks Neil,
I didn't mention but I would like to do this for Thunderbird. I was
reading this is available on Firefox 3. I would suppose width and
other settings could be gotten somehow. Any idea ?
Francisco