phantomwhale
December 12th, 2010, 09:11
After a tour around the documentation and some trial and error, I'm admitting (temporary) defeat on a simple thing - preventing the clearing of a diecontrol element.
Currently, the numbercontrol has the <noreset /> tag which prevents middle-click resetting of a number field to zero - this is essentially what I want. as middle-clicking my diecontrol's causing their contents to clear, which leads to nasty bugs around the ruleset codebase.
I tried capturing the database onUpdate event, or the onClickReleased event, to reset the value to d4 when it's been set to zero, but these seem to get called before the diecontrol has actually been cleared (e.g. getDice() still returns a die). I also tried the <disabled /> tag, but this goes too far, and disables everything.
I suspect there is a way of wrapping it in a genericcontrol, and restricting the supported interactions that way, but I was having trouble rewiring up the drag, drop, double-click and other event driven functions correctly - this seems like a lot of work too, just to disable a simple function. However, in lieu of any other suggestions, this appears to be the only avenue I've left to explore.
I also tried turning to the excellent BRP ruleset (never played with it, but worth it's weight in example code !) - but the only diecontrol I found was a diefield for the damage modifier - and surely enough, middle-clicking on this clears the dice out of it too. So I suspect Stuart might be able to make use of a <noreset /> tag here too ;)
So in summary, I'm wondering shouldn't the diecontrol have some more tags to alter it's base behaviour ? According to the ruleset documentation, it has no more tags that a basic windowcontrol, unlike the numbercontrol that has several extra ones.
Or is there possibly another way to achieve this that I'm not thinking of right now ? Ok, it's late, apologies if above e-mail comes across grumpy - I'm really not, just tired ! Thanks for any assistance :D
Currently, the numbercontrol has the <noreset /> tag which prevents middle-click resetting of a number field to zero - this is essentially what I want. as middle-clicking my diecontrol's causing their contents to clear, which leads to nasty bugs around the ruleset codebase.
I tried capturing the database onUpdate event, or the onClickReleased event, to reset the value to d4 when it's been set to zero, but these seem to get called before the diecontrol has actually been cleared (e.g. getDice() still returns a die). I also tried the <disabled /> tag, but this goes too far, and disables everything.
I suspect there is a way of wrapping it in a genericcontrol, and restricting the supported interactions that way, but I was having trouble rewiring up the drag, drop, double-click and other event driven functions correctly - this seems like a lot of work too, just to disable a simple function. However, in lieu of any other suggestions, this appears to be the only avenue I've left to explore.
I also tried turning to the excellent BRP ruleset (never played with it, but worth it's weight in example code !) - but the only diecontrol I found was a diefield for the damage modifier - and surely enough, middle-clicking on this clears the dice out of it too. So I suspect Stuart might be able to make use of a <noreset /> tag here too ;)
So in summary, I'm wondering shouldn't the diecontrol have some more tags to alter it's base behaviour ? According to the ruleset documentation, it has no more tags that a basic windowcontrol, unlike the numbercontrol that has several extra ones.
Or is there possibly another way to achieve this that I'm not thinking of right now ? Ok, it's late, apologies if above e-mail comes across grumpy - I'm really not, just tired ! Thanks for any assistance :D