Posted 20 years ago
by painetraine
I was looking tonight for an event or some way to know when state changes occur. ie. when I go from DefaultState to CommentState or some other state change.
I looked for something like StateChange or some other event but couldn't find anything. Is there any way you could fire an event when the state changes and provide the old state and the new state in the event args?
Or, maybe I just overlooked it in the docs and you can point me to it.
My problem is that I have a statedefined like so:
<ExplicitPatternGroup Type="StartScope" Token="TodoCommentStartToken" Style="CommentDelimiterStyle" PatternValue="// TODO:" />
And I want to know as soon as the user enters the TodoCommentState by pressing the : but creating the following:
<KeyPressTrigger Key="TodoTrigger" Character=":">
<KeyPressTriggerValidStates>
<KeyPressTriggerValidState State="TodoCommentState" />
</KeyPressTriggerValidStates>
</KeyPressTrigger>
Doesn't work because when I press the : I haven't entered the TodoCommentState yet but I don't want the trigger to fire whenever I press : either. It would be helpful if there was some type of StateChanged event where I could see that the new state is now TodoCommentState.
Just to make your job harder, if it would be possible to know if the current state under the cursor changed because of deletion/insertion/typing/mousemove that would be helpful as well <IMG SRC="smile.gif" border="0">
Thanks
I looked for something like StateChange or some other event but couldn't find anything. Is there any way you could fire an event when the state changes and provide the old state and the new state in the event args?
Or, maybe I just overlooked it in the docs and you can point me to it.
My problem is that I have a statedefined like so:
<ExplicitPatternGroup Type="StartScope" Token="TodoCommentStartToken" Style="CommentDelimiterStyle" PatternValue="// TODO:" />
And I want to know as soon as the user enters the TodoCommentState by pressing the : but creating the following:
<KeyPressTrigger Key="TodoTrigger" Character=":">
<KeyPressTriggerValidStates>
<KeyPressTriggerValidState State="TodoCommentState" />
</KeyPressTriggerValidStates>
</KeyPressTrigger>
Doesn't work because when I press the : I haven't entered the TodoCommentState yet but I don't want the trigger to fire whenever I press : either. It would be helpful if there was some type of StateChanged event where I could see that the new state is now TodoCommentState.
Just to make your job harder, if it would be possible to know if the current state under the cursor changed because of deletion/insertion/typing/mousemove that would be helpful as well <IMG SRC="smile.gif" border="0">
Thanks