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!