• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

gizmo form sizing/scrolling

Kairos

Well-known member
Greetings!

So I have returned to a ruleset I had set aside, and have re-encountered a pernicious issue regarding gizmo forms. To wit, I have portals that, when they expand vertically, start scrolling. What I would like to have happen is for the form itself to resize vertically dynamically instead. Any advice on how to proceed would be greatly appreciated.

gizmo.png
 
Here's an example of a form in Shadowrun that's set up to get as tall as the screen will allow, and then add a scrollbar if that's still needed (for example, on a short-monitored laptop).

The form:
Code:
  <form
    id="poCustPoss"
    name="Possession Details"
    marginhorz="10"
    marginvert="5">
    <layoutref layout="poPossess"/>
    <position><![CDATA[
      layout[poPossess].width = 480
      perform layout[poPossess].render
      width = layout[poPossess].width
      height = layout[poPossess].height
      ]]></position>
    </form>
The position script on the layout:

Code:
    <position><![CDATA[
      autogap = 15

      ~since our table uses a needtag expression to determine what can be shown
      ~we'll fix the table if there are no powers available for selection
      if (container.tagis[OptPower.?] + container.tagis[Hero.AllySpirit] = 0) then
        portal[poPower].freeze = 1
        endif

      if (container.tagis[InnateAvl.?] + container.tagis[HasInnate.?] + container.tagis[Hero.SpirInnate] <> 0) then

        ~but if we're not allowed to choose more, freeze the table
        if (container.tagis[InnateAvl.?] + container.tagis[Hero.SpirInnate] = 0) then
          portal[poSpells].freeze = 1
          endif
      else
        portal[poSpells].visible = 0
        endif

      if (portal[poPower].itemcount = 0) then
        portal[poPower].visible = 0
        endif

      if (portal[poWeakness].itemcount = 0) then
        portal[poWeakness].visible = 0
        endif

      if (container.tagexpr[SpiSklCat.? | SpiSklAllw.?] = 0) then
        portal[poActSkill].visible = 0
        endif

      portal[poDefAttr].width = 250

      perform portal[poRace].centerhorz
      perform portal[poDefAttr].centerhorz

      if (container.tagis[TemplatCat.?] + portal[poTemplate].itemcount = 0) then
        portal[poTemplate].visible = 0
        perform portal[poDefAttr].alignrel[ttob,poRace,10]
      else
        portal[poTemplate].width = width
        perform portal[poTemplate].alignrel[ttob,poRace,10]
        perform portal[poDefAttr].alignrel[ttob,poTemplate,10]
        endif

      perform portal[poDefAttr].centerhorz

      autotop = portal[poDefAttr].bottom + 10

      ~since it's possible, even after using batchplace, for the form's
      ~height to exceed the available height, we want to record what the autotop
      ~was at this point, so we can re-use it later if we need to reset the
      ~arrangement
      var oldautotop as number
      oldautotop = autotop

      perform portal[poPower].batchadd
      perform portal[poActSkill].batchadd
      perform portal[poWeakness].batchadd
      perform portal[poSpells].batchadd

      perform batchplace

      ~if there wasn't actually enough space to show all those portals, then
      ~we reset our autotop, and then set the height to a really large number.
      ~then, re-do the batchplace with that new larger amount of space.  The
      ~result will be a scrollbar for the whole form, and no scrollbars on the
      ~individual tables
      if (autotop > autobottom) then
        autotop = oldautotop

        height = 10000
        autobottom = 10000

        perform portal[poPower].batchadd
        perform portal[poActSkill].batchadd
        perform portal[poWeakness].batchadd
        perform portal[poSpells].batchadd

        perform batchplace
        endif

      height = autotop

      ]]></position>
The batchadd/batchplace may be newer than your files - that's the newer, better way of placing lots of different tables on top of each other within the autotop/autobottom/autoright/autoleft space.

.itemcount is probably also new - that's the count of items currently in that table - this layout has several tables that may or may not be needed, and hides the ones that aren't in use.
 
Back
Top