PDA

View Full Version : Help with columns in windowlist



KyleC
June 21st, 2007, 19:47
I am trying to display a list of items in a column, but can't seem to get the control to work properly.

Here is the class declaration for the individual items:


<windowclass name="charsheet_aspectlistitem">
<sizelimits>
<minimum>
<height>20</height>
</minimum>
</sizelimits>
<sheetdata>
<textlistitemvalue name="name">
<size>
<height>20</height>
<width>140</width>
</size>
<anchored>
<left>
<anchor>left</anchor>
</left>
<right>
<anchor>right</anchor>
</right>
<top>
<anchor>top</anchor>
</top>
</anchored>
</textlistitemvalue>
</sheetdata>
</windowclass>


and here is the windowlist itself:


<genericcontrol name="aspectframe">
<bounds>15,65,300,190</bounds>
<frame>
<name>sheetgroup</name>
</frame>
</genericcontrol>

<windowlist name="aspectlist">
<columns>
<width>140</width>
<fillwidth />
</columns>
<anchored>
<to>aspectframe</to>
<position>over</position>
<offset>-12,-9</offset>
<top>
<parent>aspectframe</parent>
<offset>25</offset>
</top>
</anchored>
<datasource>.aspectlist</datasource>
<class>charsheet_aspectlistitem</class>
<allowcreate />
<allowdelete />
<skipempty />
<script>
function onClickDown(button, x, y)
if not getNextWindow(nil) then
createWindow().name.setFocus();
return true;
end
end
</script>
</windowlist>



I've tinkered with various values as much as I can but just can't get it to work. What am I missing?

-KyleC

Dachannien
June 21st, 2007, 20:12
You might try ditching the <columns> tag and everything inside it. That's really the only thing different between what you have here and the similar code in the d20 ruleset.

BTW, you're just modifying the d20 ruleset, yes? I ask because <i>textlistitemvalue</i> is a template defined there.

KyleC
June 21st, 2007, 20:59
You might try ditching the <columns> tag and everything inside it. That's really the only thing different between what you have here and the similar code in the d20 ruleset.

BTW, you're just modifying the d20 ruleset, yes? I ask because <i>textlistitemvalue</i> is a template defined there.


I've just realized how poorly worded my original post is. Sorry about that!

I can't ditch the <columns> tag because that is the precise behavior I'm trying to get to work. I want the list to display in two columns, but it just won't cooperate.

-KyleC

joshuha
June 21st, 2007, 21:14
Weird, I just added it to the windowlist in my combattracker I am working on and it worked perfectly fine.

Isn't the windowlist supposed to be an embedded control in the sheetdata of the master windowclass? In your code it looks seperate (unless you didn't post the master window).

KyleC
June 21st, 2007, 21:55
Weird, I just added it to the windowlist in my combattracker I am working on and it worked perfectly fine.

Isn't the windowlist supposed to be an embedded control in the sheetdata of the master windowclass? In your code it looks seperate (unless you didn't post the master window).

So you got the code I posted to display in two columns? That is weird.

As Dachannien deduced, I am playing around with the D20 ruleset, and to answer your question, my windowlist is an embedded control in the windowclass "charsheet_main". It was basically the "language" windowlist that I renamed and tried to tweak to display in two columns.

This is bizarre if it works for you but not for me. What part of my code did you add to your windowlist? The whole thing verbatim?

joshuha
June 21st, 2007, 22:05
No, I meant I added the columns tag to the combat tracker to verify it works with the windowlist so it has to be something else.

What behavior are you seeing? It is acting normally with no columning, are you not able to add entries at all?

KyleC
June 21st, 2007, 22:19
It is acting normally with no columning.

joshuha
June 21st, 2007, 22:43
Later tonight when I get home I will test if out with your code and a windowclass that I will call via a slashline command.

One thing that might be causing issues is your anchoring on the charsheet_aspectlistitem. I would try removing the right anchor. What may be happening is the anchoring is overriding the columns since you are saying 1 row is stretching all the way left to right of a parent windowclass.

Dachannien
June 21st, 2007, 22:53
Definitely a possibility :)

Another thought I had was that the horizontal offset in the <position>over</position> anchor is too high. I'm not sure whether the -12 offset means -12 is shaved off each edge or is split such that -6 is shaved off each edge. If it's a full -12 off each edge, then your control won't fit anymore, since 140px + 140px for each column, plus 12px + 12px for the 12px off each edge, is greater than the 300 px available. Try making it -10 and see if that helps.

KyleC
June 22nd, 2007, 00:13
Definitely a possibility :)

Another thought I had was that the horizontal offset in the <position>over</position> anchor is too high. I'm not sure whether the -12 offset means -12 is shaved off each edge or is split such that -6 is shaved off each edge. If it's a full -12 off each edge, then your control won't fit anymore, since 140px + 140px for each column, plus 12px + 12px for the 12px off each edge, is greater than the 300 px available. Try making it -10 and see if that helps.

That was the problem! I changed the offset and everything works just dandy. Thanks to the both of you for looking into this.

-KyleC

DNH
January 15th, 2008, 14:01
Is it possible to get more than just two columns in a windowlist? I have section of the character sheet which lists items with short names and I would prefer to see three columns tight up against each other than two columns far apart for no apparent reason.

joshuha
January 15th, 2008, 15:08
Is it possible to get more than just two columns in a windowlist? I have section of the character sheet which lists items with short names and I would prefer to see three columns tight up against each other than two columns far apart for no apparent reason.


It should be possible. What I am wondering due to how you are doing your spacing of controls (anchoring vs set bounds) that its exceeding the maximum width of your windowlist. The combat tracker for instance is just a windowlist and it has a lot of columns.

DNH
January 16th, 2008, 11:12
Problem sorted! I had the <width> parameter within the <columns> element set too high. Now I know.

Oberoten
January 16th, 2008, 12:54
This solved a few things for me as well.
Many Kudos. Now just to figure out how to make it all annotated when dragged from a Windowslist. :)