-
August 18th, 2019, 18:40 #1
When windowlist is hidden (with data source) attached the formatting goes wrong
Folks,
In the Traveller ruleset, on the NPC sheet there's a section for Actions.
NPCformatting.jpg
It's all displaying correctly when in 'edit' mode but once edit is turned off and no actions are entered the controls below all 'move up'.
Code:<!-- Attacks --> <header_column name="header_actions" > <static textres="npc_header_actions"/> </header_column> <button_iedit name="actions_iedit"> <anchored to="header_actions" position="righthigh" offset="-15,0" /> <target>actions</target> </button_iedit> <button_iadd name="actions_iadd"> <anchored to="actions_iedit" position="lefthigh" offset="5,0" /> <target>actions</target> </button_iadd> <label name="wpntitle"> <anchored width="155"> <top parent="header_actions" anchor="bottom" relation="relative" offset="3" /> <left offset="0" /> </anchored> <static textres="npc_label_weapon" /> </label> <label name="atktitle"> <anchored to="wpntitle" position="righthigh" offset="13,0" width="40" /> <static textres="npc_label_weaponattack" /> </label> <label name="dmgtitle"> <anchored to="atktitle" position="righthigh" offset="25,0" width="68" /> <static textres="npc_label_weapondmg" /> </label> <label name="rangetitle"> <anchored to="dmgtitle" position="righthigh" offset="15,0" width="55" /> <static textres="npc_label_weaponrange" /> </label> <list_npcactions name="actions"> <script> function onInit() end </script> <anchored to="header_actions" position="bottom"> <top offset="25" /> <right offset="10" /> </anchored> <datasource>.actions</datasource> <class>npc_actions</class> </list_npcactions> <line_column name="divider4" />
And this is the class it's using:
Code:<windowclass name="npc_actions"> <margins control="0,0,0,2" /> <script file="campaign/scripts/npc_weapons.lua" /> <sheetdata> <genericcontrol name="rightanchor"> <anchored height="0" width="0"> <top/> <right /> </anchored> </genericcontrol> <button_idelete name="idelete"> <anchored> <top offset="2" /> <right parent="rightanchor" anchor="left" relation="relative" offset="-5" /> </anchored> </button_idelete> <basicstring name="name"> <bounds>5,2,160,20</bounds> </basicstring> <basicstring name="attack"> <anchored height="20" /> <bounds>175,2,30,20</bounds> <hideonvalue>0</hideonvalue> <rollable/> <center /> <script> function onInit() if rollable or (gmrollable and User.isHost()) then local w = addBitmapWidget("field_rollable"); w.setPosition("bottomleft", -1, -4); setHoverCursor("hand"); elseif rollable2 or (gmrollable2 and User.isHost()) then local w = addBitmapWidget("field_rollable_transparent"); w.setPosition("topright", 0, 2); w.sendToBack(); setHoverCursor("hand"); end end function onDragStart(button, x, y, draginfo) window.actionAttack(draginfo); return true; end function onDoubleClick(button, x, y) window.actionAttack(); return true; end </script> </basicstring> <basicstring name="damage"> <anchored height="20" /> <bounds>215,2,82,20</bounds> <frame name="fielddark" offset="5,5,5,5" /> <rollable/> <center /> <script> function onInit() if rollable or (gmrollable and User.isHost()) then local w = addBitmapWidget("field_rollable"); w.setPosition("bottomleft", -1, -4); setHoverCursor("hand"); elseif rollable2 or (gmrollable2 and User.isHost()) then local w = addBitmapWidget("field_rollable_transparent"); w.setPosition("topright", 0, 2); w.sendToBack(); setHoverCursor("hand"); end end function onDragStart(button, x, y, draginfo) window.actionDamage(draginfo); return true; end function onDoubleClick(button, x, y) window.actionDamage(); return true; end </script> </basicstring> <basicstring name="range"> <bounds>305,2,62,20</bounds> </basicstring> </sheetdata> </windowclass>
Cheers,
MBMRuleset and much more content built for FGU.
Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!
-
August 18th, 2019, 20:55 #2
Looks like the UPP label and field are getting hidden. Have a look where those fields that are moving up are anchored to - looks to me like it’s the skills section that is moving up.
As an aside - the standard for the FG data record is to run some code when the record is locked that hides fields that don’t have any data, then show all fields (so that data can be entered) when unlocked.
There’s usually a script attached to the main window that does this. Look at the 3.5E campaign\scripts\npc_main.lua file file, update function - there’s an updateControl command for each control/label pair that (for compatible controls) will show/hide them based off containing data or not (and set them read only when locked).Last edited by Trenloe; August 18th, 2019 at 21:35.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
August 18th, 2019, 23:35 #3Ruleset and much more content built for FGU.
Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!
-
August 19th, 2019, 06:37 #4
Like I said, look at what the skill section is anchored to - because it looks like that is the section that is moving up, or maybe the divider which may have controls anchored to it? I can’t tell because there’s not all of the controls in the code posted.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
August 19th, 2019, 11:28 #5
Morning Chap,
The issue in the end was that there were no anchors - the page flowed and so chucking a windowlist with a datasource really messed things up.
So what I've done to sort it (and it's working) is apply an anchor to everything below it, so that it takes into account the size of the actions windowlist, but also allows skills, traits, behaviour etc to grow. I need to read up on anchoring I think, where's a good resource?
Cheers,
MBMRuleset and much more content built for FGU.
Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!
-
August 19th, 2019, 14:46 #6
Try the Wiki developer guide here: https://www.fantasygrounds.com/wiki/...face#Anchoring
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
August 19th, 2019, 18:52 #7Ruleset and much more content built for FGU.
Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!
-
August 19th, 2019, 19:19 #8
The column templates all use anchoring - to a columnanchor control, and then cascade off that using relative anchoring. So, if you add controls to a windowclass that primarily uses column controls then it's best to anchor those controls (or a single anchor for each line) that uses the same relative anchoring, then it should all flow together. Have a look at the column templates in CoreRPG: common\template_common.xml
Relative anchoring is a very powerful way of allowing control positioning to shift automatically as controls are added/removed (making visible/not visible).Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
August 19th, 2019, 19:22 #9Ruleset and much more content built for FGU.
Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!
-
August 19th, 2019, 19:30 #10Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks