PDA

View Full Version : Scrolling Windowclass / Generic Control



ProfMarks
December 31st, 2008, 04:14
Could someone tell me how to get a generic control 'window' to scroll inside the larger page. For example, if one wanted the attributes sub-window to be able to scroll with added entries, what's the best way to do that. I know there's a scrollercontrol control, but am unsure on how to impliment it.

Thanks.

Foen
December 31st, 2008, 11:01
The classic way to implement scrollable lists is using the windowlist control. Each of your attributes would then be a windowclass in that list and you can attach a scrollercontrol to the list. For an example of how this works, take a look at the utility_notes.xml files which contains three definitions:

note windowclass: an opened note, showing all the detail (you don't probably need this for attributes);
notesmall windowclass: the definition for each entry in the list; and
notelist windowclass: the window which contains the list, a scrollercontrol and a buttoncontrol for adding new notes.

Hope that helps

Foen

ProfMarks
December 31st, 2008, 15:27
It sets me in the right direction Foen, thanks.

Before I head too deep in the rabbit hole, what I'm trying to do is create my own custom weapons section with the appropriate fields for the system I'm trying to customize. Differs greatly from the 3.5 set I'm using as a base, so starting from scratch vice re-engineering seems the way to go with this particular case.

I am not a coder, but xml doesn't scare me an I've been very successful thus far in geting the ruleset to do what I need it to do. Can I define how one weapon block will look using xml and use that for the instances or will I need to script out the details to use windowlist as it is in the default ruleset?

Thanks again.

Foen
January 1st, 2009, 08:35
Hi ProfMarks

The way it works is that you define how a single weapon looks (using a 'weaponitem' xml windowclass, for example) and then declare the window list (again in xml) to use the 'weaponitem' class for its windows. This second bit uses the 'class' tag in the window list definition.

You can avoid scripting if you only want basic rendering functionality, but if you are looking to do something more dynamic (like the way a d20 weapon switches fields depending on whether it is a melee or missile weapon), then you'll need to write some Lua script.

Cheers

Foen

ProfMarks
January 1st, 2009, 22:58
Thanks again Foen.

Your posts are really getting the inspiration and confidence going.

Foen
January 2nd, 2009, 06:43
NP. Your other question (now edited out) about whether to use a single file for both classes or separate files is a matter of preference/personal style. I find that it is generally helpful to have a list and its member windowclass in the same file, so I can easily see how changes in one can impact the other.

The one exception I make to this is when declaring character sheet contents. A character sheet page (such as the combat tab) can get so big in its own right that adding all the windowclass definitions for each list makes the file unwieldy - so I have a separate XML file for character sheet list items (not one for each, just a single one).

Just my way, but other folks do it differently.

Foen

ProfMarks
January 2nd, 2009, 06:58
Thanks again. I edited it the question out because I worked through the answer..imagine that.

Your insight is still very valued. I'm about 90% complete with this particular challenge. I did end up going inside the lua and so far, I haven't broken the design yet. I'm sure I'll have additional questions when I start testing the new code out.

Thanks again.