View Single Post
royalfa
Member
 
Join Date: Feb 2011
Posts: 37

Old January 9th, 2012, 07:10 PM
Well I change all the tab race to behave as per 4e tab race.

I don it, but I need to change the "Add Language" menu to a "Add Origin Skills" one.

I change the "setup" of the portal, the "showtemplate", fields and tags related.

I make it work but the menu do not work instead displays the list of skills (with an scroll bar) and clicking the menu "Add Origin Skill" (look on the image) pops up a window: "Nothing to chose from"



http://flickr.com/gp/50870840@N06/21mXNQ

Here is the original portal and template:

Code:
<portal
    id="raLangs"
    style="tblNormal">
    <table_dynamic
      component="Language"
      showtemplate="LangPick"
      choosetemplate="SimpleItem"
      showfixedlast="yes"
      addpick="resLangSta"
      alwaysupdate="yes">
      <list><![CDATA[
        !thing.user_added & !Hide.Language
        ]]></list>
      <candidate>TRUE</candidate>
      <autotag group="Helper" tag="StartLang"/>
      <titlebar><![CDATA[
        @text = "Add a Language - " & hero.child[resLangSta].field[resSummary].text
        ]]></titlebar>
      <description/>
      <headertitle><![CDATA[
        @text = "Languages: " & hero.child[resLangSta].field[resSummary].text
        ]]></headertitle>
      <additem><![CDATA[
        ~set the color based on whether the proper number of slots are allocated
        if (field[resLeft].value = 0) then
          @text = "{text a0a0a0}"
        elseif (field[resLeft].value < 0) then
          @text = "{text ff0000}"
          endif
        @text &= "Add New Language"
        ]]></additem>
      </table_dynamic>
    </portal>

<!-- LangItem template
  -->
  <template
    id="LangPick"
    name="Language Pick"
    compset="Language"
    marginhorz="3"
    marginvert="2">

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

    <portal
      id="username"
      style="editNormal">
      <edit
        field="UserName"
        maxlength="100">
        </edit>
      </portal>

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

    <portal
      id="delete"
      style="actDelete"
      tiptext="Click to delete this item">
      <action
        action="delete">
        </action>
      </portal>

    <portal
      id="chkliter"
      style="chkSmall">
      <checkbox
        field="lnLiterate"
        message="{/b}{text d0d0d0}Literate in Language?">
        </checkbox>
      </portal>

    <position><![CDATA[
      ~set up our height based on our tallest portal
      height = portal[info].height

      if (hero.tagis[source.OptLit?] <> 0) then
        height += portal[chkliter].height + 6
      else
        portal[chkliter].visible = 0
        endif

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

      ~position our tallest portal at the top
      portal[info].top = 0

      ~center the other portals vertically
      perform portal[name].centeron[vert,info]
      perform portal[username].centeron[vert,info]
      perform portal[delete].centeron[vert,info]

      ~position the delete portal on the far right
      perform portal[delete].alignedge[right,0]

      ~position the info portal to the left of the delete button
      perform portal[info].alignrel[rtol,delete,-8]

      ~position our literacy checkbox at the bottom
      perform portal[chkliter].alignedge[bottom,-2]
      perform portal[chkliter].centerhorz

      var edge as number
      edge = portal[info].left - 5

      ~position the name on the left and let it use all available space
      portal[name].left = 0
      portal[name].width = minimum(portal[name].width,edge)

      ~if this is a "custom" item pick, show an edit portal instead of the name
      if (tagis[Helper.CustomItem] <> 0) then
        portal[name].visible = 0
        portal[username].left = portal[name].left
        var limit as number
        limit = portal[info].left - portal[username].left - 5
        portal[username].width = minimum(200,limit)
      else
        portal[username].visible = 0
        endif

      ~if this is an auto-added pick, change its font to indicate that fact
      if (ispick + !candelete >= 2) then
        perform portal[name].setstyle[lblAuto]
        endif
      ]]></position>

    </template>
Here are the changes I did: (same name raLangs to avoid, at least for a while change all references)

Code:
<portal
    id="raLangs"
    style="tblNormal">
    <table_dynamic
      component="Skill"
      showtemplate="OriginPick"
      choosetemplate="SimpleItem"
      showfixedlast="yes"
      addpick="resOrSkill"
      alwaysupdate="yes">
      <list><![CDATA[
        !thing.user_added & !Hide.Skill
        ]]></list>
      <candidate>TRUE</candidate>
      <autotag group="Helper" tag="OrSkill"/>
      <titlebar><![CDATA[
        @text = "Add origin skill - " & hero.child[resOrSkill].field[resSummary].text
        ]]></titlebar>
      <description/>
      <headertitle><![CDATA[
        @text = "Skills: " & hero.child[resOrSkill].field[resSummary].text
        ]]></headertitle>
      <additem><![CDATA[
        ~set the color based on whether the proper number of slots are allocated
        if (field[resLeft].value = 0) then
          @text = "{text a0a0a0}"
        elseif (field[resLeft].value < 0) then
          @text = "{text ff0000}"
          endif
        @text &= "Add Origin Skill"
        ]]></additem>
      </table_dynamic>
    </portal>

<template
    id="OriginPick"
    name="Origin Skills Pick"
    compset="Skill"
    marginhorz="3"
    marginvert="2">

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

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

    <portal
      id="delete"
      style="actDelete"
      tiptext="Click to delete this item">
      <action
        action="delete">
        </action>
      </portal>

    <position><![CDATA[
      ~set up our height based on our tallest portal
      height = portal[info].height

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

      ~position our tallest portal at the top
      portal[info].top = 0

      ~center the other portals vertically
      perform portal[name].centeron[vert,info]
      perform portal[delete].centeron[vert,info]

      ~position the delete portal on the far right
      perform portal[delete].alignedge[right,0]

      ~position the info portal to the left of the delete button
      perform portal[info].alignrel[rtol,delete,-8]

      var edge as number
      edge = portal[info].left - 5

      ~position the name on the left and let it use all available space
      portal[name].left = 0
      portal[name].width = minimum(portal[name].width,edge)
      
      ]]></position>

    </template>
I'm tired of look the error lol

Last edited by royalfa; January 9th, 2012 at 07:11 PM. Reason: Don't show the image
royalfa is offline   #1 Reply With Quote