celestian
July 3rd, 2019, 07:15
I suspect my problem has something to do with my window/subwindows and windowlist but I'll be darned if I can't find it.
This is a simple prototype combattracker window that I'm tinkering with to try out some new layouts. My plan is to have a subwindow on the left of the mainwindow that contains the list of all the creatures (in order in initiative/etc at some point). I've got the windows layed out and threw some critters in but it seems my scroll bar is missing.
Here is the picture.
https://i.imgur.com/ujZlheP.png
Here is the code for the primary window.
<windowclass name="combattracker_host">
<frame>cta_box</frame>
<placement>
<size width="650" height="500" />
</placement>
<sizelimits>
<minimum width="400" height="300" />
<dynamic />
</sizelimits>
<softclose />
<nodelete />
<script>
function onInit()
self.onSizeChanged = sizeChanged;
end
function sizeChanged(source)
local nX, nY = getSize();
local nCombatantsX, nCombatantsY = combatants.getSize();
local nDefaultOffset = -90;
local nMaxWidth = 150;
local nCenter = math.floor((nX/2) + 0.5);
if (nCenter > nMaxWidth+math.abs(nDefaultOffset)) then
local nAdjust = nMaxWidth - nCenter;
combatants.setAnchor("right","contentanchor","center","absolute",nAdjust);
else
combatants.setAnchor("right","contentanchor","center","absolute",nDefaultOffset);
end
end
</script>
<sheetdata>
<contentanchor_ctabox name="contentanchor"/>
<subwindow name="combatants">
<anchored to="contentanchor">
<top anchor="bottom" relation="relative" offset="25" />
<left anchor="left" offset="10" />
<right anchor="center" offset="-90" />
<bottom parent="" anchor="bottom" offset="-40" />
</anchored>
<activate />
<fastinit />
<class>cta_combatant_list_host</class>
<script>
function onDrop(x, y, draginfo)
return subwindow.list.onDrop(x, y, draginfo);
end
</script>
</subwindow>
<button_cta_menu />
<resize_ctabox />
<help_cta />
<close_ctabox />
</sheetdata>
</windowclass>
Here is the list windowclass (subwindow on main) and it's associated template.
<windowclass name="cta_combatant_list_host">
<frame>groupbox</frame>
<sheetdata>
<list_cta_combatants_host name="list" />
<scrollbar>
<anchored to="list" />
<target>list</target>
</scrollbar>
</sheetdata>
</windowclass>
<template name="list_cta_combatants_host">
<windowlist name="list">
<script file="cta/scripts/cta_host.lua" />
<child></child>
<child><backcolor>1A40301E</backcolor></child>
<anchored>
<top anchor="top" relation="relative" offset="1" />
<left anchor="left" offset="1" />
<right anchor="right" offset="-1" />
<bottom anchor="bottom" offset="-1" />
</anchored>
<datasource>.list</datasource>
<class>combatants_entry_host</class>
<empty font="list-empty-ct" textres="ct_emptylist" />
</windowlist>
</template>
The list just is a stringu of the names of all the creatures while I sort out the scrollbar issue.
Every other time I've setup a scrollbar like the above bold section it has worked for the windowlist. Am I just covering it up hiding it somewhere? You can still use the mouse to wheel up/down the list (with out without the <Scrollbar> options) but the scrollbar needs to be there for mouse clickers.
I've tinkered with this for a few hours and I'm just not seeing it (the problem or the bar).
This is a simple prototype combattracker window that I'm tinkering with to try out some new layouts. My plan is to have a subwindow on the left of the mainwindow that contains the list of all the creatures (in order in initiative/etc at some point). I've got the windows layed out and threw some critters in but it seems my scroll bar is missing.
Here is the picture.
https://i.imgur.com/ujZlheP.png
Here is the code for the primary window.
<windowclass name="combattracker_host">
<frame>cta_box</frame>
<placement>
<size width="650" height="500" />
</placement>
<sizelimits>
<minimum width="400" height="300" />
<dynamic />
</sizelimits>
<softclose />
<nodelete />
<script>
function onInit()
self.onSizeChanged = sizeChanged;
end
function sizeChanged(source)
local nX, nY = getSize();
local nCombatantsX, nCombatantsY = combatants.getSize();
local nDefaultOffset = -90;
local nMaxWidth = 150;
local nCenter = math.floor((nX/2) + 0.5);
if (nCenter > nMaxWidth+math.abs(nDefaultOffset)) then
local nAdjust = nMaxWidth - nCenter;
combatants.setAnchor("right","contentanchor","center","absolute",nAdjust);
else
combatants.setAnchor("right","contentanchor","center","absolute",nDefaultOffset);
end
end
</script>
<sheetdata>
<contentanchor_ctabox name="contentanchor"/>
<subwindow name="combatants">
<anchored to="contentanchor">
<top anchor="bottom" relation="relative" offset="25" />
<left anchor="left" offset="10" />
<right anchor="center" offset="-90" />
<bottom parent="" anchor="bottom" offset="-40" />
</anchored>
<activate />
<fastinit />
<class>cta_combatant_list_host</class>
<script>
function onDrop(x, y, draginfo)
return subwindow.list.onDrop(x, y, draginfo);
end
</script>
</subwindow>
<button_cta_menu />
<resize_ctabox />
<help_cta />
<close_ctabox />
</sheetdata>
</windowclass>
Here is the list windowclass (subwindow on main) and it's associated template.
<windowclass name="cta_combatant_list_host">
<frame>groupbox</frame>
<sheetdata>
<list_cta_combatants_host name="list" />
<scrollbar>
<anchored to="list" />
<target>list</target>
</scrollbar>
</sheetdata>
</windowclass>
<template name="list_cta_combatants_host">
<windowlist name="list">
<script file="cta/scripts/cta_host.lua" />
<child></child>
<child><backcolor>1A40301E</backcolor></child>
<anchored>
<top anchor="top" relation="relative" offset="1" />
<left anchor="left" offset="1" />
<right anchor="right" offset="-1" />
<bottom anchor="bottom" offset="-1" />
</anchored>
<datasource>.list</datasource>
<class>combatants_entry_host</class>
<empty font="list-empty-ct" textres="ct_emptylist" />
</windowlist>
</template>
The list just is a stringu of the names of all the creatures while I sort out the scrollbar issue.
Every other time I've setup a scrollbar like the above bold section it has worked for the windowlist. Am I just covering it up hiding it somewhere? You can still use the mouse to wheel up/down the list (with out without the <Scrollbar> options) but the scrollbar needs to be there for mouse clickers.
I've tinkered with this for a few hours and I'm just not seeing it (the problem or the bar).