cscase
January 25th, 2014, 08:22
I'm trying to add a feature to ruleset which allows the user to toggle the state of a skill by double-clicking the name of the skill. I think I know how to code what I want to do, but I can't get the skill labels to respond to any events, so I can't even really get to square 1.
The skills are all items on a windowlist, so there is a windowclass that defines the entry for a skill on this list. In the windowclass are all of the values for the skill. Basically they are the label, which is the name of the skill, the rating value, and the pool value. The label is a stringfield, and I am trying to attach a script block to that which includes an onDoubleClick function. Here's my windowclass, below. I'll try to trim out parts that seem irrelevant for brevity's sake.
<windowclass name="char_skill">
<script file="campaign/scripts/char_skill.lua" />
<sheetdata>
<genericcontrol name="rightanchor">
<anchored width="0" height="0">
<top />
<right />
</anchored>
<invisible />
</genericcontrol>
<button_idelete name="idelete">
<anchored width="15" height="12">
<top offset="4" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-2" />
</anchored>
</button_idelete>
<genericcontrol name="idelete_spacer">
<anchored width="15" height="12">
<top offset="4" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-2" />
</anchored>
<disabled />
<invisible />
</genericcontrol>
<numberfield name="pool">
trimmed ...
</numberfield>
<number_charskillfield name="rating">
...
</number_charskillfield>
<stringfield name="label">
<anchored height="15">
<top offset="2" />
<left offset="1" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-2" />
</anchored>
<font>sheetlabelsmallbold</font>
<tabtarget next="rating" />
<script>
function onDoubleClick(x,y) <!-- HERE is the event I'm trying to get working -->
Debug.chat('BAM!');
end
</script>
</stringfield>
</sheetdata>
</windowclass>
What's happening is I can put the event in and get no errors, but double-clicking on the label stringfield does nothing. onClick is the same way. It works on item items in this windowclass, but not on the label stringfield.
Does this make any sense? Am I leaving out important info? Does this sound recognizable as a common gotcha or anything? Any ideas what I need to be looking at would be appreciated!
The skills are all items on a windowlist, so there is a windowclass that defines the entry for a skill on this list. In the windowclass are all of the values for the skill. Basically they are the label, which is the name of the skill, the rating value, and the pool value. The label is a stringfield, and I am trying to attach a script block to that which includes an onDoubleClick function. Here's my windowclass, below. I'll try to trim out parts that seem irrelevant for brevity's sake.
<windowclass name="char_skill">
<script file="campaign/scripts/char_skill.lua" />
<sheetdata>
<genericcontrol name="rightanchor">
<anchored width="0" height="0">
<top />
<right />
</anchored>
<invisible />
</genericcontrol>
<button_idelete name="idelete">
<anchored width="15" height="12">
<top offset="4" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-2" />
</anchored>
</button_idelete>
<genericcontrol name="idelete_spacer">
<anchored width="15" height="12">
<top offset="4" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-2" />
</anchored>
<disabled />
<invisible />
</genericcontrol>
<numberfield name="pool">
trimmed ...
</numberfield>
<number_charskillfield name="rating">
...
</number_charskillfield>
<stringfield name="label">
<anchored height="15">
<top offset="2" />
<left offset="1" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-2" />
</anchored>
<font>sheetlabelsmallbold</font>
<tabtarget next="rating" />
<script>
function onDoubleClick(x,y) <!-- HERE is the event I'm trying to get working -->
Debug.chat('BAM!');
end
</script>
</stringfield>
</sheetdata>
</windowclass>
What's happening is I can put the event in and get no errors, but double-clicking on the label stringfield does nothing. onClick is the same way. It works on item items in this windowclass, but not on the label stringfield.
Does this make any sense? Am I leaving out important info? Does this sound recognizable as a common gotcha or anything? Any ideas what I need to be looking at would be appreciated!