We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Insert additional text when chosing from ContextChoicePopup list?

I am currently using Essential Suite I have a need to modify what happens when something is chosen from the list generated in the ContextChoicePopup event of the Edit control. For example: if the list generated in ContextChoicePopup event contains ''MethodA'' and ''MethodB'', and the user selects ''MethodA'', the control will insert the text ''MethodA''. What I need to do is insert something like: ''MethodA(param1,param2)'' Can you suggest a way to do this with this version of the Syncfusion Edit control? If it''s not possible in this version (, is it possible in the current version?

3 Replies

FR Frank June 17, 2005 09:12 PM UTC

No responses so far ... does anyone have any idea how to do this? My users really want this. Thanks in advance to anyone who can help out...

AD Administrator Syncfusion Team July 5, 2005 03:49 PM UTC

Hi Frank, If you do not have the source code version, this functionality would be limited to placing the entire string (MethodA(param1,param2)) as the context choice item. If you have the source code, then this can be accomplished with a couple of code modifications. When adding the choice, instead of inserting a string, add a string[] like this: choices.Add(new string[]{"object1_Method2","(param1, param2)"}); Next, in the ContextChoice class (ContextChoice.cs), modify the following methods: In ListBoxChoices_DrawItem(), at the end of the method you will see a call to e.Graphics.DrawString, passing in the text from the ListBoxChoices list. Add the following before that call: string itemText = ""; if(ListBoxChoices.Items[e.Index].GetType() == typeof(string[])) { itemText = ((string[])ListBoxChoices.Items[e.Index])[0]; } else { itemText = ListBoxChoices.Items[e.Index].ToString(); } Then modify the call to add the new itemText e.Graphics.DrawString(itemText,... Also in the class, modify the ContextChoice_VisibleChanged as follows Change ListBoxChoices.Items.Add(ItemList[i].ToString()); to be ListBoxChoices.Items.Add(ItemList[i]); Finally, in the EditView class (EditView.cs), modify the KeyPressWithContextChoice to change the insertion calls from edit.Insert(editContextChoice.ListBoxChoices.Text); to if(editContextChoice.ListBoxChoices.SelectedItem.GetType() == typeof(string[])) { //parse the entry edit.Insert(((string[])editContextChoice.ListBoxChoices.SelectedItem)[0]); edit.Insert(((string[])editContextChoice.ListBoxChoices.SelectedItem)[1]); } else { //standard single string entry edit.Insert(editContextChoice.ListBoxChoices.Text); }

FR Frank August 2, 2005 10:14 PM UTC

Sorry for the lateness of this Thank You, but this did the trick. We did purchase the source code so this was easy to implement. I, and my users, thank you!

Live Chat Icon For mobile
Up arrow icon