PDA

View Full Version : dynamic headings in a windowlist



DNH
June 27th, 2007, 14:39
ok, here's a challenge for you (by which i mean i had a go at it meself, but failed!) ...

i have a windowlist of weapons;
i want a heading above each column in the list (type, no of attacks, damage etc);
i want the heading to be anchored to the first item in the list (the top item);

i am pretty sure this can be done along the following lines:

when a wpn is added to the list, check to see if it is sorted so as to be the first. this should be done by checking to see if getPrevWindow returns null or not if it IS the first item, use something like createControl("wpnlistfieldlabel","wpnlistlabel_name"); to create a stringcontrol (template) the template would be something like a static stringcontrol of the appropriate label; i am sure this can be done much more efficiently using arrays and counters but that is probably beyond me

this is all to do with resizing, as i want to be able to resize the window and have the list items and their headings come with me.

feel free to tell me it cannot be done

thanks.

sloejack
June 27th, 2007, 16:16
I'm not sure you can do this AND be able to resize. Since field definitions generally have fixed dimensions I'm not aware of any way to dynamicly resize fields along with a window.

Toadwart
June 27th, 2007, 20:23
Sounds like it would work to me but my immediate thought is why try to embed the heading inside the windowlist?
Could be easier to have another (generic control) above the windowlist with the heading fields inside of it. Add a handler to the windowlist so that when it is resized the header control also resizes itself to match.
Not sure how complex it would be to make sure the column headers lined up with the columns but I figure if your header fields used the same anchoring as their matching fields in the windowlist entry class they should resize/move in the same way.

TarynWinterblade
June 29th, 2007, 04:31
Sounds like it would work to me but my immediate tought is why try to embed the heading inside the windowlist.
Could be easier to have another (a generic control) above the windowlist with the heading fields inside of it. Add a handler to the windowcontrol so that when it is resized the header control also resizes itself to match.
Not sure how complex it would be to make sure the column headers lined up with the columns but I figure if your header fields used the same anchoring as their matching field in the windowlist entry class they should resize/move in the same way.

I agree with Toadwart on this one. Don't try and have me script something that's accomplish-able through simpler methods! :P

As a note though, you'll want to make sure that you use <disable /> on the string controls you use as headers, so that you can click through them.