PDA

View Full Version : modifying a grid's headers


pep
05-18-2004, 09:03 PM
I just want to adjust my grid header's fontsize

I do not find any attribute to set that (setting a fontsize="10" somewhere does not work)

antun
05-19-2004, 10:45 AM
You could subclass basegridcolumn and pretty much copy most of the lz/gridcolumn.lzx code that you need into it. I've done a rough start here:


<canvas debug="true">
<dataset name="contacts" request="true"
src="http://laszlosystems.com/lps/sample-apps/contacts/contactsdata.xml"/>

<class name="mygridcol" extends="basegridcolumn">
<attribute name="text" type="text" />
<button name="mybutton"
clip="true"
placement="header"
text="${classroot.text}"
fontstyle="bold"
fontsize="14"
text_padding_x="20"
focusable="$once{classroot.sortable}"
doesenter="false"
onclick="parent.doSort()"
clickable="$once{classroot.sortable}">

<method name="setClickable" args="cl">
<![CDATA[ super.setClickable( cl && classroot.sortable );]]>
</method>

<view resource="lzgridsortarrow_rsrc" name="sortarrow"
x="${ parent._title.x + parent._title.width + 2}"
y="${ parent.titleshift + parent.height/2 - height/2}"
frame="${ classroot.ascendsort ? 1 : 2 }"
visible="${ classroot.hasSort }"/>

<attribute name="width"
value="${ classroot.width -
( parent.resizable ?
parent.resizer.width : 0 ) }"/>
</button>


</class>

<grid datapath="contacts:/resultset">
<gridcolumn showheader="false" width="50">
<view bgcolor="#CCCCCC" width="${parent.width}"
placement="header"
height="${parent.immediateParent.height-1}"/>
<text datapath="position()"/>
</gridcolumn>

<mygridcol width="200">foo
<!-- <text placement="header" align="center"
valign="middle">Check 'em off</text> -->
<text datapath="@displayname"/>
</mygridcol>

<gridcolumn sortable="false">Home
<checkbox value="$path{'@home_default'}"
xoffset="${10-parent.width/2}">
<method event="onvalue">
this.datapath.updateData();
</method>
</checkbox>
</gridcolumn>
</grid>

</canvas>


You'd also want to use TTF fonts, rather than the default one.

-Antun