PDA

View Full Version : Trouble with Headers


royalfa
January 5th, 2012, 08:59 PM
Well I must say that this is a simple trouble if I think in all the things I still need to do (make classes for my game for instance).

Well I finally finish successfully the Skill tab, at least at my taste.

But I can't "put" the headers in each of the columns.

Here is my code (template only):

<template
id="skSklPick"
name="Skill Pick"
compset="Skill">

<portal
id="name"
style="lblNormal"
showinvalid="yes">
<label
field="name">
</label>
</portal>

<portal
id="value"
style="lblXLarge">
<label
field="sklRoll">
</label>
<live>!Hero.Monster</live>
<mouseinfo><![CDATA[
var traithist as string
call TraitHist
@text = traithist
]]></mouseinfo>
</portal>

<portal
id="incr"
style="incrSimple">
<incrementer
field="trtUser">
</incrementer>
<live>Hero.Monster</live>
<mouseinfo><![CDATA[
var traithist as string
call TraitHist
@text = traithist
]]></mouseinfo>
</portal>

<portal
id="chktrained"
style="chkNormal">
<checkbox
field="sklUserTrn">
</checkbox>
<mouseinfo><![CDATA[
@text = "Check this box to train the '" & field[name].text & "' skill."
]]></mouseinfo>
</portal>

<portal
id="lbltrained"
style="lblXLrgDis">
<label
field="sklTrained">
</label>
<mouseinfo><![CDATA[
@text = "This skill has been automatically trained by another source, and does not count against your limit of trained skills."
]]></mouseinfo>
</portal>

<portal
id="attr"
style="lblSkill">
<label>
<labeltext><![CDATA[
if (islinkage[attribute] = 0) then
@text = "-"
done
endif
var attrabbr as string
attrabbr = left(linkage[attribute].field[name].text,3)
attrabbr = uppercase(attrabbr)
@text = field[sklAttr].text
@text &= " {size 40}(" & attrabbr & ")"
]]></labeltext>
</label>
</portal>

<portal
id="other"
style="lblSkill">
<label>
<labeltext><![CDATA[
if (field[trtFinal].value = 0) then
@text = "-"
else
@text = signed(field[trtFinal].value)
endif
]]></labeltext>
</label>
<mouseinfo><![CDATA[
var traithist as string
var traitonly as number
traitonly = 1
call TraitHist
@text = traithist
]]></mouseinfo>
</portal>

<portal
id="info"
style="actInfo">
<action
action="info">
</action>
</portal>

<!-- Header Portals -->
<portal
id="hdrTotal"
style="lblHeader"
isheader="yes">
<label
text="Total">
</label>
</portal>

<portal
id="hdrTrained"
style="lblHeader"
isheader="yes">
<label
text="Trained?">
</label>
</portal>

<portal
id="hdrAttr"
style="lblHeader"
isheader="yes">
<label
text="Attribute">
</label>
</portal>

<portal
id="hdrOther"
style="lblHeader"
isheader="yes">
<label
text="Other">
</label>
</portal>

<position><![CDATA[
~set up our height; our width is pre-initialized for us
height = portal[info].height + 5

~if this is a "sizing" calculation, we're done
doneif (issizing <> 0)

~center our tallest portal
perform portal[info].centervert

~center the other portals on the tallest one
perform portal[name].centeron[vert,info]
perform portal[value].centeron[vert,info]
perform portal[incr].centeron[vert,info]
perform portal[lbltrained].centeron[vert,info]
perform portal[attr].centeron[vert,info]
perform portal[other].centeron[vert,info]

~position the info portal on the far right
perform portal[info].alignedge[right,-23]

~center the numbers in a specific place
var numleft as number
numleft = 175
portal[value].left = numleft - (portal[value].width / 2)
perform portal[incr].centeron[horz,value]
portal[lbltrained].left = numleft + 60 - (portal[lbltrained].width / 2)
portal[attr].left = numleft + 135 - (portal[attr].width / 2)
portal[other].left = numleft + 210 - (portal[other].width / 2)

~by default, show our 'trained' checkbox. Always show it if our trained
~field is set, since we need to give the user the chance to uncheck it.
var ischeckbox as number
ischeckbox = 1
if (field[sklUserTrn].value = 0) then

~if we can train unlimited skills, just show everything
if (hero.child[resSkills].tagis[User.ResUnlim] <> 0) then
~ do nothing, checkbox already visible
else

~don't show it if we're not a class skill
if (tagis[Skill.?] <> 0) then
if (hero.isidentity[Skill] = 0) then
ischeckbox = 0
endif
endif

~don't show it if we're automatically trained
if (tagis[Helper.TrainedAut] <> 0) then
ischeckbox = 0
endif
endif
endif

~center our trained checkbox on the label, and show it instead if this is
~a class skill
perform portal[chktrained].centeron[horz,lbltrained]
perform portal[chktrained].centeron[vert,lbltrained]
portal[chktrained].visible = ischeckbox
portal[lbltrained].visible = !portal[chktrained].visible

~position the name on the left and make sure its width does not exceed the available space
portal[name].left = 23
portal[name].width = minimum(portal[name].width,portal[value].left - portal[name].left - 10)
]]></position>

<header><![CDATA[
~set up our height; our width is pre-initialized for us
height = portal[hdrTotal].height + 5

~if this is a "sizing" calculation, we're done
doneif (issizing <> 0)

~position the title portals above the appropriate numbers
perform portal[hdrTotal].centeron[horz,value]
perform portal[hdrTrained].centeron[horz,lbltrained]
perform portal[hdrAttr].centeron[horz,attr]
perform portal[hdrOther].centeron[horz,other]
]]></header>

</template>


Don't find the error. The game compiles fine, the tab do not show the headers not even "over" another text.

Thanks and I will keep working all I can.

Mathias
January 6th, 2012, 09:29 AM
Whether or not to use a template-based header is set on the definition of the table


headertemplate="skSklPick"


should be the setting you'll want.

Here's the relevant page of the wiki, BTW:

http://hlkitwiki.wolflair.com/index.php5/TableDynamic_Element_(Data) (http://hlkitwiki.wolflair.com/index.php5/TableDynamic_Element_(Data)

royalfa
January 6th, 2012, 02:13 PM
Thanks Mathias problem solve.

Now I have issues with the "race info" portal.

I only display the "info" if the race is selected but only shows 7 lines of text instead of all the info.

I try to change the height of the portal (portal[raInfoTbl].height = 100) but nothing changes.

this is the code:

<!-- raRaceInfo template
Displays info for the current race in a large template area.
-->
<template
id="raRaceInfo"
name="Trait Pick"
compset="Trait">

<portal
id="details"
style="lblNormal">
<label
ismultiline="yes">
<labeltext><![CDATA[
var descript as string
var nodescript as number
nodescript = 1
call Descript
@text = "{align left}" & descript
]]></labeltext>
</label>
</portal>

<position><![CDATA[
~set up our height based on our tallest portal
portal[details].width = width
height = portal[details].textheight
]]></position>

</template>



<layout
id="race">
<portalref portal="raTitle"/>
<portalref portal="chRace" taborder="10"/>
<portalref portal="Horizontal"/>
<portalref portal="raInfoTbl"/>

<position><![CDATA[
~position and size the tables to span the full layout
portal[raTitle].top = 20
portal[raTitle].left = 20
portal[chRace].top = 20
portal[chRace].width = width / 2
portal[chRace].left = portal[raTitle].width + 30
portal[chRace].height = 20


~set the separator width and position it beneath the attributes
portal[Horizontal].width = portal[raTitle].width + portal[chRace].width - 10
portal[Horizontal].top = portal[chRace].bottom + 15
portal[Horizontal].left = portal[raTitle].left + 20

if (hero.tagis[Race.?] = 0) then
portal[raInfoTbl].visible = 0
endif

portal[raInfoTbl].left = portal[Horizontal].left
portal[raInfoTbl].width = width - (portal[raInfoTbl].left * 2)
portal[raInfoTbl].top = portal[Horizontal].bottom + 20
~portal[raInfoTbl].height = height - portal[raInfoTbl].top


]]></position>

</layout>

Other issue that can't figure it out is the "Icon mouseover text".

I know how to do it with an info icon but in the d20 class panel, for each class, they show different icons:
attack saves spells and special

When you "moseover" on the icon a text appears (like info) moreover in each case the texts corresponding to your class level is in bold other text is gray.

Maybe this is more advanced than the things I'm doing and I still need a lot of traits to the game: Saves for example but all the help will be appreciated.

Thanks again
Roy

By the way the wikipage you linked to me is empty.

Mathias
January 6th, 2012, 02:34 PM
By the way the wikipage you linked to me is empty.

Sorry about that - apparently the auto-detection of links on this forum doesn't like web addresses that end in a ")" Try the Portal link from this page: http://hlkitwiki.wolflair.com/index.php5/Data_File_Reference

I'll try to get to the rest over the weekend (I'm afraid I probably won't have time this afternoon).

royalfa
January 7th, 2012, 09:11 PM
Don't worry a lot of thanks and good weekend.

Roy

Mathias
January 9th, 2012, 08:58 AM
Ignore this one

Mathias
January 9th, 2012, 09:03 AM
I see you have the line that sets the height of portal[raInfoTbl] commented out - unless you tell HL to give that table lots of height, you'll only get the default height for your display.

royalfa
January 9th, 2012, 06:52 PM
I have a new layout (from the 4e tab race) and with that line not commented, still only 8 lines in description.

Thanks