Posted 19 years ago
by Kevin Phillips
Hi,
I've just bought the syntax editor (version 3.1.202.0 - I'm using vs.net 2003) and it seems to be doing the job really well, except I haven't been able to solve a little problem I have with the intelli-prompt that I'm hoping someone can shed some light on.
I'm using it to show the available attributes for an XML tag, so when you hit space and you're inside an XML tag I show it. I set the pre-text to be the item you've selected followed by =" and the post-test to be " so you can then just type in the value. This is fine unless you type one of the items in the intelli-prompt list by hand and then type =. The = closes the intelli-prompt list but it still adds the extra stuff which is not what I want. I would have thought that as I didn't actually pick anything from the list it would "Cancel" the intelli-prompt and therefore not do any text insertion (I tried attaching an event listener to the closing and closed events and both have the Cancel property set to false).
Did that make sense? If not, here's some code. Create a new winforms project and drop the syntax editor onto the Form1 form then open up the Form1 code and paste this into the constructor:Then add an event handler for the Trigger event of the syntax editor and put the following code in it:
Now run it and type the following string into the syntax editor:
<hello item=
You'll see that after you type = you end up with this:
<hello item="="
I'd rather it just closed the intelli-prompt list and inserted nothing in this case, is there a way I could achieve this? Thanks for your help,
Kev
I've just bought the syntax editor (version 3.1.202.0 - I'm using vs.net 2003) and it seems to be doing the job really well, except I haven't been able to solve a little problem I have with the intelli-prompt that I'm hoping someone can shed some light on.
I'm using it to show the available attributes for an XML tag, so when you hit space and you're inside an XML tag I show it. I set the pre-text to be the item you've selected followed by =" and the post-test to be " so you can then just type in the value. This is fine unless you type one of the items in the intelli-prompt list by hand and then type =. The = closes the intelli-prompt list but it still adds the extra stuff which is not what I want. I would have thought that as I didn't actually pick anything from the list it would "Cancel" the intelli-prompt and therefore not do any text insertion (I tried attaching an event listener to the closing and closed events and both have the Cancel property set to false).
Did that make sense? If not, here's some code. Create a new winforms project and drop the syntax editor onto the Form1 form then open up the Form1 code and paste this into the constructor:
KeyPressTrigger trigger = new KeyPressTrigger("MyTrigger", false, ' ');
trigger.ValidLexicalStates.Add(syntaxEditor1.Document.Language.LexicalStates[0]);
syntaxEditor1.Document.Language.Triggers.Add(trigger);
IntelliPromptMemberList memberList = syntaxEditor1.IntelliPrompt.MemberList;
memberList.Clear();
memberList.Add(new IntelliPromptMemberListItem("item", 0, null, "item=\"", "\""));
memberList.Show();
<hello item=
You'll see that after you type = you end up with this:
<hello item="="
I'd rather it just closed the intelli-prompt list and inserted nothing in this case, is there a way I could achieve this? Thanks for your help,
Kev