sharing xul elements between toolbars

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

sharing xul elements between toolbars

Nikhil Johny
hi, i am new to xul. i was wondering if there was a way to share elements between 2 toolbars.

for example, lets say i have toolbar_1 with a text box and a button. i want to create toolbar_2 with the same button as the button which i defined in toolbar_1 along with other buttons. i would also like to style the toolbar_1 and toolbar_2 differently.

how can i achieve this? i am aware of the use of overlays but i hope to use a different method.

is this possible using the DOM?

thank you
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: sharing xul elements between toolbars

Neil-4
Nikhil Johny wrote:

>hi, i am new to xul. i was wondering if there was a way to share elements between 2 toolbars.
>
>for example, lets say i have toolbar_1 with a text box and a button. i want to create toolbar_2 with the same button as the button which i defined in toolbar_1 along with other buttons. i would also like to style the toolbar_1 and toolbar_2 differently.
>  
>
What do you mean by "the same button"? If you allow your toolbars to be
customised, then the user could simply drag the button to whichever
toolbar they wanted it on. Or am I misunderstanding the use case?

--
Warning: May contain traces of nuts.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: sharing xul elements between toolbars

Nikhil Johny
i meant that the functionality of the button in toolbar_2 is same as the toolbar_1. but the styling might be different. so its actually the same button but slightly different. the example i provided is just a example. here the real problem:

i want to create a toolbar in fullscreen mode. it will contain the back and forward button just like the normal view(defined in browser.xul) but i would like to style it differently. also there is some other features like a url bar with a smaller width. so i would need to use the same url bar as the normal view but i would need to change css to give it a smaller width.

how to achieve this? is this possible using the DOM?

_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: sharing xul elements between toolbars

Neil-4
Nikhil Johny wrote:

>i meant that the functionality of the button in toolbar_2 is same as the toolbar_1. but the styling might be different. so its actually the same button but slightly different. the example i provided is just a example. here the real problem:
>
>i want to create a toolbar in fullscreen mode. it will contain the back and forward button just like the normal view(defined in browser.xul) but i would like to style it differently. also there is some other features like a url bar with a smaller width. so i would need to use the same url bar as the normal view but i would need to change css to give it a smaller width.
>
>how to achieve this? is this possible using the DOM?
>  
>
This is sometimes possible for a regular button (or indeed, a single
menuitem). Often these items have a very simple action, and if you are
lucky the action is delegated to another element, called a command or
broadcaster. Therefore all you need to is to create your own custom
button and designate the same command/broadcaster and that will often be
all you need to clone the behaviour.

However I don't think this is possible for more complex objects like the
URL bar. Instead what you could consider is to change the styling of the
existing elements in full screen mode. (This includes overriding the
hiding of the navigation toolbar in full screen mode.) It might even be
possible to do this entirely in CSS.

--
Warning: May contain traces of nuts.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: sharing xul elements between toolbars

Nikhil Johny
so do you mean that to create the new toolbar, i would need to do the following:

1. create the toolbar using the <toolbar>.
2. create the custom back and forward button and use the command and broadcaster technique to achieve the same functionality. then use css to style the new button as i wish.
3. for the url bar i could just change the style directly to get the smaller width. then i can append the url bar to my new toolbar when i activate the fullscreen mode.
4. also i wanted to bring the tabs toolbar to the same line as the back button and url bar. again i can use DOM for this.
5. i can position my element as above using the DOM,right?(i am still working with the DOM so i am not quite sure if this would work. please mention if i am wrong.)

Thank You
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|

Re: sharing xul elements between toolbars

Neil-4
Nikhil Johny wrote:

>so do you mean that to create the new toolbar, i would need to do the following:
>
>1. create the toolbar using the <toolbar>.
>2. create the custom back and forward button and use the command and broadcaster technique to achieve the same functionality. then use css to style the new button as i wish.
>3. for the url bar i could just change the style directly to get the smaller width. then i can append the url bar to my new toolbar when i activate the fullscreen mode.
>4. also i wanted to bring the tabs toolbar to the same line as the back button and url bar. again i can use DOM for this.
>5. i can position my element as above using the DOM,right?(i am still working with the DOM so i am not quite sure if this would work. please mention if i am wrong.)
>  
>
I don't know for sure whether your suggestion would or would not work,
but you might find you suffer from side effects of moving elements
around in the DOM, such as the URL bar might forget its value.

--
Warning: May contain traces of nuts.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul