Bidmaron
March 24th, 2014, 02:07
OK, this is my first extension where I need to actually mess with new UI components. I did fine up to the point where I had to put in a check on/off button control. Now I cannot get the button to show up with any combination of the anchor tags I've been able to try. Below is a screen shot of what I'm getting right now. The check on/off button (for this data, it would be off, or an empty circle) I want to show up to the left of "Multiply Selectable".
6308
Here is my window code:(the red sets up the area with the 'Multiply Selectable' label, the line above it, and the button.
<sheetdata>
<anchor_column name="columnanchor" />
<label_column name="alttype_label">
<static textres="Ref_Label_FeatType" />
</label_column>
<string_columnhc name="alttype">
<script>
function onInit()
if super.onInit then
super.onInit();
end
local w = addBitmapWidget("solidblack");
w.setPosition("topright", -1,5);
end
</script>
</string_columnhc>
<label_column name="prerequisites_label">
<static textres="ref_label_prereq" />
</label_column>
<string_columnh name="prerequisites">
</string_columnh>
<line_column name="line_benefit" />
<label_column name="benefit_label">
<static textres="ref_label_benefit" />
</label_column>
<ft_columnh name="benefit">
<anchored>
<top parent="columnanchor" anchor="bottom" relation="relative" offset="27" />
</anchored>
<separator>line_benefit</separator>
</ft_columnh>
<line_column name="line_normal" />
<label_column name="normal_label">
<static textres="ref_label_normal" />
</label_column>
<ft_columnh name="normal">
<anchored>
<top parent="columnanchor" anchor="bottom" relation="relative" offset="27" />
</anchored>
<separator>line_normal</separator>
</ft_columnh>
<line_column name="line_mult" />
<label_column_right name="mult_label">
<static textres="Ref_Label_Mult" />
<anchored>
<top parent="columnanchor" anchor="bottom" relation="relative" offset="0" />
</anchored>
</label_column_right>
<button_checkboxh name="mult">
<separator>line_mult</separator>
<anchored to="mult_label" position="left" offset="30,30" />
</button_checkboxh>
<line_column name="line_special" />
<label_column name="special_label">
<static textres="ref_label_special" />
</label_column>
<ft_columnh name="special">
<anchored>
<top parent="columnanchor" anchor="bottom" relation="relative" offset="27" />
</anchored>
<separator>line_special</separator>
</ft_columnh>
</sheetdata>
This is the template for button_checkboxh:(where button_checkbox is a CoreRPG template in the template_column.xml file)
<template name="button_checkboxh">
<button_checkbox>
<script file="scripts/button_checkbox.lua" />
</button_checkbox>
</template>
Here is the code in button_checkbox.lua: (this is working since the line above the label and the label are showing up (plus, the debugs are printing out okay))
-
-
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onInit()
self.update(isReadOnly());
end
function update(bReadOnly, bForceHide)
local bLocalShow;
if bForceHide then
bLocalShow = false;
else
bLocalShow = true;
if bReadOnly and not nohide then
bLocalShow = false;
end
if nohide then
bLocalShow=true;
end
end
Debug.chat("blocalshow",bLocalShow,"readonly",bReadOnly);
setReadOnly(bReadOnly);
setVisible(bLocalShow);
local sLabel = getName() .. "_label";
if window[sLabel] then
Debug.chat("doing label");
window[sLabel].setVisible(bLocalShow);
end
if separator then
if window[separator[1]] then
Debug.chat("doing line");
window[separator[1]].setVisible(bLocalShow);
end
end
if self.onVisUpdate then
self.onVisUpdate(bLocalShow, bReadOnly);
end
return bLocalShow;
end
I think my problem is that I just don't understand all the anchoring stuff very well. I have had great success adding standard labels and fields, but the moment I'm trying to add this very straightforward button control.....
Thanks for anyone who can tell me the anchor trick I'm missing.
6308
Here is my window code:(the red sets up the area with the 'Multiply Selectable' label, the line above it, and the button.
<sheetdata>
<anchor_column name="columnanchor" />
<label_column name="alttype_label">
<static textres="Ref_Label_FeatType" />
</label_column>
<string_columnhc name="alttype">
<script>
function onInit()
if super.onInit then
super.onInit();
end
local w = addBitmapWidget("solidblack");
w.setPosition("topright", -1,5);
end
</script>
</string_columnhc>
<label_column name="prerequisites_label">
<static textres="ref_label_prereq" />
</label_column>
<string_columnh name="prerequisites">
</string_columnh>
<line_column name="line_benefit" />
<label_column name="benefit_label">
<static textres="ref_label_benefit" />
</label_column>
<ft_columnh name="benefit">
<anchored>
<top parent="columnanchor" anchor="bottom" relation="relative" offset="27" />
</anchored>
<separator>line_benefit</separator>
</ft_columnh>
<line_column name="line_normal" />
<label_column name="normal_label">
<static textres="ref_label_normal" />
</label_column>
<ft_columnh name="normal">
<anchored>
<top parent="columnanchor" anchor="bottom" relation="relative" offset="27" />
</anchored>
<separator>line_normal</separator>
</ft_columnh>
<line_column name="line_mult" />
<label_column_right name="mult_label">
<static textres="Ref_Label_Mult" />
<anchored>
<top parent="columnanchor" anchor="bottom" relation="relative" offset="0" />
</anchored>
</label_column_right>
<button_checkboxh name="mult">
<separator>line_mult</separator>
<anchored to="mult_label" position="left" offset="30,30" />
</button_checkboxh>
<line_column name="line_special" />
<label_column name="special_label">
<static textres="ref_label_special" />
</label_column>
<ft_columnh name="special">
<anchored>
<top parent="columnanchor" anchor="bottom" relation="relative" offset="27" />
</anchored>
<separator>line_special</separator>
</ft_columnh>
</sheetdata>
This is the template for button_checkboxh:(where button_checkbox is a CoreRPG template in the template_column.xml file)
<template name="button_checkboxh">
<button_checkbox>
<script file="scripts/button_checkbox.lua" />
</button_checkbox>
</template>
Here is the code in button_checkbox.lua: (this is working since the line above the label and the label are showing up (plus, the debugs are printing out okay))
-
-
-- Please see the license.html file included with this distribution for
-- attribution and copyright information.
--
function onInit()
self.update(isReadOnly());
end
function update(bReadOnly, bForceHide)
local bLocalShow;
if bForceHide then
bLocalShow = false;
else
bLocalShow = true;
if bReadOnly and not nohide then
bLocalShow = false;
end
if nohide then
bLocalShow=true;
end
end
Debug.chat("blocalshow",bLocalShow,"readonly",bReadOnly);
setReadOnly(bReadOnly);
setVisible(bLocalShow);
local sLabel = getName() .. "_label";
if window[sLabel] then
Debug.chat("doing label");
window[sLabel].setVisible(bLocalShow);
end
if separator then
if window[separator[1]] then
Debug.chat("doing line");
window[separator[1]].setVisible(bLocalShow);
end
end
if self.onVisUpdate then
self.onVisUpdate(bLocalShow, bReadOnly);
end
return bLocalShow;
end
I think my problem is that I just don't understand all the anchoring stuff very well. I have had great success adding standard labels and fields, but the moment I'm trying to add this very straightforward button control.....
Thanks for anyone who can tell me the anchor trick I'm missing.