Posted 18 years ago
by GavinK151
hi guys, looking for a bit of guidance on 2 things for intellsense, having a hard time understanding where to go...
The situation:
My application allows users to edit HTML. They can however insert tags that look something like:Now, after the "mytag:" only a finite set of items are valid ("if", "when", "with") and I can get a list to popup with the options by defining a trigger inside the ActiproSoftware.HTML.xml file thus:
In the States section I have:
I then added this new state as a ChildState to the "DefaultState" in the ActiproSoftware.HTML.xml file.
(do I need to do this?)
...and finally in SyntaxEditor_Trigger() I populate the list:so far so good.
Now if the user selects "if" from the list I would like them to then be able to press " " (space) and get a list of valid attributes that are ONLY valid for the "if" (lets say "condition", "flag" and "on" are valid for if). However here is where I run into problems.
I tried to define a trigger for " " (space) character:I have set it to be valid in the same State "MyState" as the other trigger ":", and then I check for it once more in SyntaxEditor_Trigger() however it never seems to fire. Now I *think* I might need to define another state but to be honest I am completely lost at this point.
nothing in the samples seem to do this sort of thing so i was hoping someone could tell me where I am going wrong and perhaps provide a small example?
The second thing I am unclear on is how I can trigger the closing tag when the user has finished entering their attributes:
<mytag:if condition="whatever" on="true" >
So when they finally type ">" I want to close off "mytag:if" like so:How do I "look backwards" to see what to use? i.e. how can know to insert </mytag:if> upon input of the ">"? I think I might be able to do this via the _regionSyntaxEditor_KeyTyping() event but once more I am struggling. I know its done automatically when you select from the intellisense list if you provide the relevent parameters when adding a new IntelliPromptMemberListItem but I only want the completion to take place when the user finally hits ">"...
Many apologies for this huge post, I have been struggling with this for a while now and hope it might be more productive asking for advice/examples.
thanks for reading this far :-)
Gav
[Modified at 03/22/2006 09:31 AM]
The situation:
My application allows users to edit HTML. They can however insert tags that look something like:
<mytag:if condition="whatever" on="true">
some more stuff here
</mytag:if>
<KeyPressTrigger Key="MyTagTrigger" Character=":">
<KeyPressTriggerValidStates>
<KeyPressTriggerValidState State="MyState" />
</KeyPressTriggerValidStates>
</KeyPressTrigger>
<State Key="MyState" TokenKey="MyState">
<Scopes>
<Scope>
<RegexPatternGroup Type="StartScope" TokenKey="MyStateStart" PatternValue="<mytag" />
<RegexPatternGroup Type="EndScope" TokenKey="MyStateStop" PatternValue=">" />
</Scope>
</Scopes>
</State>
(do I need to do this?)
...and finally in SyntaxEditor_Trigger() I populate the list:
IntelliPromptMemberList memberList = SyntaxEditor.IntelliPrompt.MemberList;
memberList.ImageList = SyntaxEditor.ReflectionImageList;
int imageIndex = (int)ActiproSoftware.Products.SyntaxEditor.IconResource.InternalEvent;
memberList.Clear();
memberList.Add(new IntelliPromptMemberListItem("if", imageIndex, null, "if>", "</mytag:if>"));
.
.
.
etc
Now if the user selects "if" from the list I would like them to then be able to press " " (space) and get a list of valid attributes that are ONLY valid for the "if" (lets say "condition", "flag" and "on" are valid for if). However here is where I run into problems.
I tried to define a trigger for " " (space) character:
<KeyPressTrigger Key="MySpaceTagTrigger" Character=" ">
<KeyPressTriggerValidStates>
<KeyPressTriggerValidState State="MyState" />
</KeyPressTriggerValidStates>
</KeyPressTrigger>
nothing in the samples seem to do this sort of thing so i was hoping someone could tell me where I am going wrong and perhaps provide a small example?
The second thing I am unclear on is how I can trigger the closing tag when the user has finished entering their attributes:
<mytag:if condition="whatever" on="true" >
So when they finally type ">" I want to close off "mytag:if" like so:
</mytag:if>
Many apologies for this huge post, I have been struggling with this for a while now and hope it might be more productive asking for advice/examples.
thanks for reading this far :-)
Gav
[Modified at 03/22/2006 09:31 AM]