Posted 18 years ago
by Jeff Cohen
I've created a few simple snippets and they work great inside the editor. My snippets tend to be pretty simple - the user usually can fill in one or two fields.
Sometimes I need to show a list of possible choices for one of the fields in addition to accepting arbitrary text. So I thought I would pop an intellisense member list when the field activates, like this:But a couple of unexpected things happen:
1. When I select an item in the member list, it is appended to the default value to the field, when I need it to replace the default value instead. So if my default value for a field is defined in the snippet as "size", and then I pick "two" from the intellisense list, the field value becomes "sizetwo" instead of "two".
2. The intellisense list works only the first time the field activates. If the user tabs to the next field and then tabs back to the first field, the event is triggered again but the member list simply flickers for an instant and then disappears.
3. Finally, I tried to handle the "CodeSnippetFieldModified" event so I could find out what value the user had chosen (or typed in manually), but it seems there's no way to find out what value was actually entered.
Any suggestions? Perhaps I've overlooked something in the documentation?
Thanks!
Jeff
Sometimes I need to show a list of possible choices for one of the fields in addition to accepting arbitrary text. So I thought I would pop an intellisense member list when the field activates, like this:
void editor_CodeSnippetFieldActivated(object sender, CodeSnippetFieldEventArgs e)
{
editor.IntelliPrompt.DropShadowEnabled = true;
editor.IntelliPrompt.MemberList.Clear();
editor.IntelliPrompt.MemberList.Add(new IntelliPromptMemberListItem("one", 0));
editor.IntelliPrompt.MemberList.Add(new IntelliPromptMemberListItem("two", 0));
editor.IntelliPrompt.MemberList.Add(new IntelliPromptMemberListItem("three", 0));
editor.IntelliPrompt.MemberList.Show();
}
1. When I select an item in the member list, it is appended to the default value to the field, when I need it to replace the default value instead. So if my default value for a field is defined in the snippet as "size", and then I pick "two" from the intellisense list, the field value becomes "sizetwo" instead of "two".
2. The intellisense list works only the first time the field activates. If the user tabs to the next field and then tabs back to the first field, the event is triggered again but the member list simply flickers for an instant and then disappears.
3. Finally, I tried to handle the "CodeSnippetFieldModified" event so I could find out what value the user had chosen (or typed in manually), but it seems there's no way to find out what value was actually entered.
Any suggestions? Perhaps I've overlooked something in the documentation?
Thanks!
Jeff