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.
Unfortunately, activation email could not send to your email. Please try again.

Insert additional text when chosing from ContextChoicePopup list?

Thread ID:

Created:

Updated:

Platform:

Replies:

30170 Jun 13,2005 12:30 PM Aug 2,2005 06:14 PM Windows Forms 3
loading
Tags: EditControl
Frank
Asked On June 13, 2005 12:30 PM

I am currently using Essential Suite 1.6.1.8. 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 (1.6.1.8), is it possible in the current version?

Frank
Replied On June 17, 2005 05:12 PM

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 11:49 AM

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); }

Frank
Replied On August 2, 2005 06:14 PM

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!

CONFIRMATION

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.

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.

;