celestian
May 28th, 2018, 05:23
So, I'm trying to navigate from down in a subwindow, up then back down into another to get a value set for a "edit" button.
Runtime Notice: s'list_abilitynotes' | s'window' | windowinstance = { class = combat_mini_section, node = combattracker.list.id-00002, x,y,w,h = 640,254,389,140 }
Runtime Notice: s'list_abilitynotes' | s'window.parentcontrol.getName' | s'mini_combat_window'
Runtime Notice: s'list_abilitynotes' | s'window.parentcontrol.window' | windowinstance = { class = charsheet_combat, node = combattracker.list.id-00002, x,y,w,h = 610,199,469,515 }
Runtime Notice: s'list_abilitynotes' | s'window.parentcontrol.window.weapons' | subwindow = { x,y,w,h = 15,197,442,308 }
Runtime Notice: s'list_abilitynotes' | s'window.parentcontrol.window.weapons.subwindow' | nil
Runtime Notice: s'list_abilitynotes' | s'window.parentcontrol.window.weapons.actions_iedi t' | nil
Runtime Notice: s'list_abilitynotes' | s'window.parentcontrol.window.subwindow' | nil
Runtime Notice: s'list_abilitynotes' | s'window.parentcontrol.window.abilitynotes_iadd' | buttoncontrol = { x,y,w,h = 414,35,0,0 }
As you can see "window" is combat_mini_section, the one I want to backup some so I try "window.parentcontrol" which is mini_combat_window which then I get "window.parentcontrol.window" which is at the level I want to be at (charsheet_combat). From that point I can now go back down.
charsheet_combat contains the subwindow "weapons" which you can see returns "subwindow" in the debug output... so I expect window.parentcontrol.window.weapons.subwindow to work... but it doesn't as you can see from the "nil" result.
I need to get the value from *.weapons.subwindow.actions_iedit.getValue().
I did a test to see if I could access another variable within charsheet_combat (abilitynotes_iadd) and I could access that item (last thing listed in debug) so it's within the same scope but I'm stumped why *.weapons.subwindow doesn't work as I'd expect it.
Here is the charsheet_combat clipped section.
<windowclass name="charsheet_combat">
<sheetdata>
<anchor_title_charsheet name="contentanchor" />
<!-- mini combat window -->
<label_charframetop name="minicombattitle">
<anchored height="20">
<top offset="35" />
<left offset="30" />
<right offset="-50" />
</anchored>
<icons>char_abilities</icons>
<static textres="char_label_combat" />
</label_charframetop>
<button_iadd_abilitynotes name="abilitynotes_iadd">
<anchored to="minicombattitle" position="insidetopright" offset="5,0" />
<target>abilitynotes</target>
</button_iadd_abilitynotes>
<subwindow name="mini_combat_window">
<anchored to="minicombattitle">
<top anchor="bottom" />
<left />
<right />
</anchored>
<class>combat_mini_section</class>
<activate />
<fastinit />
</subwindow>
<!-- END mini combat window -->
<sub_sheet_actions name="weapons">
<anchored to="contentanchor">
<top parent="mini_combat_window" anchor="bottom" offset="2" />
<left />
<right parent="" offset="-12,0" />
<bottom parent="" offset="-10" />
</anchored>
<class>charsheet_actions_weapons</class>
</sub_sheet_actions>
And here is a clipped section of the charsheet_actions_weapons which contains the button/result I'm looking for.
<windowclass name="charsheet_actions_weapons">
<margins control="0,0,15,7" />
<script>
function onDrop(x, y, draginfo)
if contents.subwindow.weapons.onDrop(x, y, draginfo) then
return true;
end
return false;
end
</script>
<sheetdata>
<button_iedit name="actions_iedit">
<anchored position="insidebottomright" offset="10,10" />
<tooltip textres="char_tooltip_actionedit" />
<script>
function onValueChanged()
local bEditMode = (getValue() == 1);
window.weapons_iadd.setVisible(bEditMode);
window.parentcontrol.window.abilitynotes_iadd.setV isible(bEditMode);
if bEditMode then
DB.setValue(window.getDatabaseNode(), "powermode", "string", "standard");
DB.setValue(window.getDatabaseNode(), "powerdisplaymode", "string", "");
end
window.contents.subwindow.weapons.update();
window.parentcontrol.window.mini_combat_window.sub window.abilitynotes.update(bEditMode)
end
</script>
</button_iedit>
What I am trying to do is get the "value" of the button to determine if the button is indeed in edit mode is a rather roundabout way but right now that's only I can for now.
I'm going to keep poking at this but I've exhausted my theories on how to get down to the value.
Runtime Notice: s'list_abilitynotes' | s'window' | windowinstance = { class = combat_mini_section, node = combattracker.list.id-00002, x,y,w,h = 640,254,389,140 }
Runtime Notice: s'list_abilitynotes' | s'window.parentcontrol.getName' | s'mini_combat_window'
Runtime Notice: s'list_abilitynotes' | s'window.parentcontrol.window' | windowinstance = { class = charsheet_combat, node = combattracker.list.id-00002, x,y,w,h = 610,199,469,515 }
Runtime Notice: s'list_abilitynotes' | s'window.parentcontrol.window.weapons' | subwindow = { x,y,w,h = 15,197,442,308 }
Runtime Notice: s'list_abilitynotes' | s'window.parentcontrol.window.weapons.subwindow' | nil
Runtime Notice: s'list_abilitynotes' | s'window.parentcontrol.window.weapons.actions_iedi t' | nil
Runtime Notice: s'list_abilitynotes' | s'window.parentcontrol.window.subwindow' | nil
Runtime Notice: s'list_abilitynotes' | s'window.parentcontrol.window.abilitynotes_iadd' | buttoncontrol = { x,y,w,h = 414,35,0,0 }
As you can see "window" is combat_mini_section, the one I want to backup some so I try "window.parentcontrol" which is mini_combat_window which then I get "window.parentcontrol.window" which is at the level I want to be at (charsheet_combat). From that point I can now go back down.
charsheet_combat contains the subwindow "weapons" which you can see returns "subwindow" in the debug output... so I expect window.parentcontrol.window.weapons.subwindow to work... but it doesn't as you can see from the "nil" result.
I need to get the value from *.weapons.subwindow.actions_iedit.getValue().
I did a test to see if I could access another variable within charsheet_combat (abilitynotes_iadd) and I could access that item (last thing listed in debug) so it's within the same scope but I'm stumped why *.weapons.subwindow doesn't work as I'd expect it.
Here is the charsheet_combat clipped section.
<windowclass name="charsheet_combat">
<sheetdata>
<anchor_title_charsheet name="contentanchor" />
<!-- mini combat window -->
<label_charframetop name="minicombattitle">
<anchored height="20">
<top offset="35" />
<left offset="30" />
<right offset="-50" />
</anchored>
<icons>char_abilities</icons>
<static textres="char_label_combat" />
</label_charframetop>
<button_iadd_abilitynotes name="abilitynotes_iadd">
<anchored to="minicombattitle" position="insidetopright" offset="5,0" />
<target>abilitynotes</target>
</button_iadd_abilitynotes>
<subwindow name="mini_combat_window">
<anchored to="minicombattitle">
<top anchor="bottom" />
<left />
<right />
</anchored>
<class>combat_mini_section</class>
<activate />
<fastinit />
</subwindow>
<!-- END mini combat window -->
<sub_sheet_actions name="weapons">
<anchored to="contentanchor">
<top parent="mini_combat_window" anchor="bottom" offset="2" />
<left />
<right parent="" offset="-12,0" />
<bottom parent="" offset="-10" />
</anchored>
<class>charsheet_actions_weapons</class>
</sub_sheet_actions>
And here is a clipped section of the charsheet_actions_weapons which contains the button/result I'm looking for.
<windowclass name="charsheet_actions_weapons">
<margins control="0,0,15,7" />
<script>
function onDrop(x, y, draginfo)
if contents.subwindow.weapons.onDrop(x, y, draginfo) then
return true;
end
return false;
end
</script>
<sheetdata>
<button_iedit name="actions_iedit">
<anchored position="insidebottomright" offset="10,10" />
<tooltip textres="char_tooltip_actionedit" />
<script>
function onValueChanged()
local bEditMode = (getValue() == 1);
window.weapons_iadd.setVisible(bEditMode);
window.parentcontrol.window.abilitynotes_iadd.setV isible(bEditMode);
if bEditMode then
DB.setValue(window.getDatabaseNode(), "powermode", "string", "standard");
DB.setValue(window.getDatabaseNode(), "powerdisplaymode", "string", "");
end
window.contents.subwindow.weapons.update();
window.parentcontrol.window.mini_combat_window.sub window.abilitynotes.update(bEditMode)
end
</script>
</button_iedit>
What I am trying to do is get the "value" of the button to determine if the button is indeed in edit mode is a rather roundabout way but right now that's only I can for now.
I'm going to keep poking at this but I've exhausted my theories on how to get down to the value.