[Project_owners] Dialog/Window resizing

Philip Chee philip.chee at gmail.com
Sat Oct 8 16:44:57 EDT 2005


On Fri, 07 Oct 2005 20:24:20 +0200, Paul Tomlin wrote:
> Philip Chee wrote:

>> You could start here:
>> <http://lxr.mozilla.org/seamonkey/source/toolkit/content/widgets/dialog.xml#14>
>> extend the binding with something like:
>> <http://lxr.mozilla.org/seamonkey/source/toolkit/content/widgets/general.xml#260>
>> and then style it with something like:
>> <http://lxr.mozilla.org/seamonkey/source/toolkit/themes/qute/global/global.css#148>

> I think I understand how that's all meant to fit together. However, as
> soon as I add a <content /> element to the binding, I loose the
> OK/Cancel buttons generated by the dialog. I'm very new to XBL so I'm
> not sure if this is to be expected or if I'm just being thick.
[...]

I'm just starting out with XBL myself so don't take anything I say as canon.

> quickfileDialog.xml
> =======================================================================
> <bindings xmlns="http://www.mozilla.org/xbl"
> 
> xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
> 
> 	<binding id="resizable-dialog"
> extends="chrome://global/content/bindings/dialog.xml#dialog">
> 		<content>
> 			<children />
> 			
> 			<xul:resizer dir="bottomright"/>
> 		</content>
> 	</binding>
> </bindings>
> =======================================================================

I think you will need to replace the complete content stanza:

=======================================================================
<bindings xmlns="http://www.mozilla.org/xbl"

xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <binding id="resizable-dialog"
extends="chrome://global/content/bindings/dialog.xml#dialog">
    <content>
      <xul:vbox class="box-inherit dialog-content-box" flex="1">
        <children/>
      </xul:vbox>

      <xul:hbox class="dialog-button-box" anonid="buttons"

xbl:inherits="pack=buttonpack,align=buttonalign,dir=buttondir,orient=buttonorient"
pack="end">
        <xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
        <xul:spacer anonid="spacer" flex="1" hidden="true"/>
        <xul:button dlgtype="accept" class="dialog-button"/>
        <xul:button dlgtype="extra1" class="dialog-button" hidden="true"/>
        <xul:button dlgtype="cancel" class="dialog-button"/>
        <xul:button dlgtype="help" class="dialog-button" hidden="true"/>
        <xul:button dlgtype="disclosure" class="dialog-button" hidden="true"/>
      </xul:hbox>
      <!-- resizer widget -->
      <xul:statusbarpanel class="statusbar-resizerpanel">
        <xul:resizer dir="bottomright"/>
      </xul:statusbarpanel>
    </content>
  </binding>
</bindings>
=======================================================================

The class="statusbar-resizerpanel" automatically pulls in this css:
<http://lxr.mozilla.org/seamonkey/source/toolkit/themes/qute/global/global.css#148>
So you don't have to specify pack="end" align="end" -moz-appearance etc.

See: Using Spacers in
<http://xulplanet.com/tutorials/xultu/springs.html>
There are also some useful hints about using maxheight, maxwidth to control
the size of your XUL box/dialog/etc.

By the way if you use class="quickfileDialog" instead of id then your
binding can be reusable.


Phil
-- 
Philip Chee <philip at aleytys.pc.my>, <philip.chee at gmail.com>
http://flashblock.mozdev.org/
Guard us from the she-wolf and the wolf, and guard us from the thief,
oh Night, and so be good for us to pass.
[ ]24 hours in a day and 24 beers in a case.  Hmmmm.....
* TagZilla 0.059


More information about the Project_owners mailing list