Is it possible to resize a tree row ?

26 views
Skip to first unread message

Christophe Charron

unread,
Apr 6, 2007, 2:53:47 PM4/6/07
to
Hi,
everything is told in the subject.
In fact, i think it is impossible because when i use "Ctrl+" or
"ctrl-", lot of objects change their size except tree rows. And then,
text does'nt fit any more if it was a "ctrl+" !!

Could somebody tell me more about it ? a bug ?

--
Cordially,
Christophe Charron

Igor Tandetnik

unread,
Apr 6, 2007, 3:05:59 PM4/6/07
to
Christophe Charron <christophe....@gmail.com> wrote:
> everything is told in the subject.

You can assign height to rows in a stylesheet. For example:

treechildren::-moz-tree-row {
height: 100px;
}

Changing the font size in the tree also results in rows getting taller
to accomodate larger text (but in my experiments, choosing smaller font
size didn't result in rows getting shorter):

treechildren {
font-size: 200%;
}

Igor Tandetnik


Neil

unread,
Apr 6, 2007, 3:59:37 PM4/6/07
to
Igor Tandetnik wrote:

>Changing the font size in the tree also results in rows getting taller to accomodate larger text (but in my experiments, choosing smaller font size didn't result in rows getting shorter)
>

The default theme styles rows with a height of 1.3em and a min-height of
18px.

--
Warning: May contain traces of nuts.

Neil

unread,
Apr 6, 2007, 4:00:31 PM4/6/07
to
Christophe Charron wrote:

>In fact, i think it is impossible because when i use "Ctrl+" or "ctrl-", lot of objects change their size except tree rows.
>

Unfortunately tree rows remember their height when they are created, and
don't subsequently adjust for font size changes.

Igor Tandetnik

unread,
Apr 6, 2007, 4:13:03 PM4/6/07
to
Neil <ne...@parkwaycc.co.uk> wrote:
> Christophe Charron wrote:
>
>> In fact, i think it is impossible because when i use "Ctrl+" or
>> "ctrl-", lot of objects change their size except tree rows.
> Unfortunately tree rows remember their height when they are created,
> and don't subsequently adjust for font size changes.

There's a way to force them. This works for me:

var stylesheet = document.styleSheets[0];
var rule = "tree {-moz-binding: none !important;}";
stylesheet.insertRule(rule, stylesheet.cssRules.length);
stylesheet.deleteRule(stylesheet.cssRules.length - 1);

Removing and re-enabling XBL binding seems to force the tree to
recalculate its metrics based on whatever styles are effective at the
time.

Igor Tandetnik


Christophe Charron

unread,
Apr 6, 2007, 5:43:03 PM4/6/07
to
On 6 avr, 21:05, "Igor Tandetnik" <itandet...@mvps.org> wrote:

> Christophe Charron <christophe.charron....@gmail.com> wrote:
> > everything is told in the subject.
>
> You can assign height to rows in a stylesheet. For example:
>
> treechildren::-moz-tree-row {
> height: 100px;
>
> }
>
> Changing the font size in the tree also results in rows getting taller
> to accomodate larger text (but in my experiments, choosing smaller font
> size didn't result in rows getting shorter):
>
> treechildren {
> font-size: 200%;
>
> }
>
Thanks, both work.
Is there a way to use classes with treechildren::-moz-tree-row
I tried treechildren::-moz-tree-row(test) {
height: 100px;
}
but no change !!
> Igor Tandetnik
--
Cordially,
Christophe Charron

Christophe Charron

unread,
Apr 6, 2007, 5:47:54 PM4/6/07
to
On 6 avr, 22:13, "Igor Tandetnik" <itandet...@mvps.org> wrote:
Whoua ... i'll try that ...
A "last" question: Is there a way to know if font size was changed ?
--
Cordially,
Christophe Charron

Christophe Charron

unread,
Apr 6, 2007, 5:49:35 PM4/6/07
to
On 6 avr, 22:00, Neil <n...@parkwaycc.co.uk> wrote:
> Christophe Charron wrote:
> >In fact, i think it is impossible because when i use "Ctrl+" or "ctrl-", lot of objects change their size except tree rows.
>
> Unfortunately tree rows remember their height when they are created, and
> don't subsequently adjust for font size changes.

Why only trees ? Other objects don't seem to remember this
property ? !

--
Cordially,
Christophe Charron

Neil

unread,
Apr 6, 2007, 7:19:52 PM4/6/07
to
Christophe Charron wrote:

> Is there a way to use classes with treechildren::-moz-tree-row

No. Each row in a tree is the same height.

Neil

unread,
Apr 6, 2007, 7:23:07 PM4/6/07
to
Igor Tandetnik wrote:

> Removing and re-enabling XBL binding seems to force the tree to
> recalculate its metrics based on whatever styles are effective at the
> time.

Actually anything that will recreate the tree body frame will do -
hiding and showing the tree should work, I think.

Igor Tandetnik

unread,
Apr 6, 2007, 7:39:36 PM4/6/07
to
Neil <ne...@parkwaycc.co.uk> wrote:
> Igor Tandetnik wrote:
>
>> Removing and re-enabling XBL binding seems to force the tree to
>> recalculate its metrics based on whatever styles are effective at the
>> time.
>
> Actually anything that will recreate the tree body frame will do -
> hiding and showing the tree should work, I think.

If you mean just doing

var tree = document.getElementById(...);
tree.collapsed = true;
tree.collapsed = false;

then I just tried it, it doesn't work. Row height doesn't change.

Igor Tandetnik


Neil Deakin

unread,
Apr 6, 2007, 9:31:38 PM4/6/07
to

Collapsing an element doesn't remove the frame, it just sets the width
and height to 0. But if you set the hidden property it should do what
you want.

/ Neil

Christophe Charron

unread,
Apr 7, 2007, 5:30:01 AM4/7/07
to
On 7 avr, 01:19, Neil <n...@parkwaycc.co.uk> wrote:
> Christophe Charron wrote:
> > Is there a way to use classes with treechildren::-moz-tree-row
>
> No. Each row in a tree is the same height.
I can understand that and i think it's a good way to build a tree. But
can different trees, in the same window, have different styles and
classes (i'm talking about moz-tree-row) ?

Christophe Charron

unread,
Apr 7, 2007, 7:28:21 AM4/7/07
to
On 7 avr, 11:30, "Christophe Charron"

Thanks to everybody : I managed what i wanted to do. You can see an
example here http://test03.christophe-charron.org/public/xul/2007_04_06/2007_04_06_css.xul
I just have a little problem with my "setTimeout" to allow a good
refresh and i hope i'll find my mistake but it works.
I still don't understand why 'Ctrl+" and "Ctrl-" don't change
treechildren font-size but ... nevermind...

--
Cordially,
Christophe Charron

Igor Tandetnik

unread,
Apr 9, 2007, 11:56:50 AM4/9/07
to

It appears to only work if the element is "unhidden" asynchronously,
like this:

var tree = document.getElementById(...);
tree.setAttribute("hidden", "true");
window.setTimeout(function() {tree.removeAttribute("hidden");}, 0);

Unfortunately, this creates a pretty nasty flicker on the screen as a
side effect,especially if <tree> element occupies a significant area of
the window, as it does in my application. The binding technique I use
works synchronously and doesn't flicker as much.

Igor Tandetnik


Reply all
Reply to author
Forward
0 new messages