Senior Member
Volunteer Data File Author
Join Date: Feb 2009
Posts: 173
|
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. Authoring Kit Rule Sets (now with functioning links!): Qin: The Warring States Doctor Who: Adventures in Time and Space MEGS/BoH/DC Heroes (work in progress) |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
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> 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> .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. |
#2 |
Senior Member
Volunteer Data File Author
Join Date: Feb 2009
Posts: 173
|
Brilliant! Thanks, M!
Authoring Kit Rule Sets (now with functioning links!): Qin: The Warring States Doctor Who: Adventures in Time and Space MEGS/BoH/DC Heroes (work in progress) |
#3 |
|
|