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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Insert additional text when chosing from ContextChoicePopup list?

Thread ID:





30170 Jun 13,2005 04:30 PM UTC Aug 2,2005 10:14 PM UTC WinForms 3
Tags: EditControl
Asked On June 13, 2005 04:30 PM UTC

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?

Replied On 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...

Administrator [Syncfusion]
Replied On 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); }

Replied On 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!


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon