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.

Closing ContextChoicePopup after string filtering

Thread ID:

Created:

Updated:

Platform:

Replies:

80156 Mar 17,2009 08:15 PM Mar 19,2009 12:23 AM Windows Forms 4
loading
Tags: EditControl
David
Asked On March 17, 2009 08:15 PM

Ok, i have populated my context choice popup list with 3 objects > eg, car, cardio and carpet.

As i press c on the keyboard, the list is displayed with all 3 items. As i type "car", all 3 remain but when i type "card", only cardio remains. This is as expected.

The problem is, is that if i typed "carb", then no entry matches this string and so results in an empty list. This is a little unfriendly, and i would prefer it if the context popup would close when no items are matched.

I've tried comparing the selected item with GetCurrentWord() and that doesnt work. Any help please?

Thanks in advanced, David.


Administrator [Syncfusion]
Replied On March 18, 2009 08:10 AM

Hi David,

Thank you for using Syncfusion products.

Please use the code snippet below to close the context popup if the entered string not matches the list.

[C#]

void editControl1_KeyUp(object sender, KeyEventArgs e)
{
string s = this.editControl1.GetCurrentWord();

if (s != "car" && s != "card" && s != "cardio")
{
this.editControl1.CloseContextChoice();
}
}

Please let me know if this helps you.

Regards,
Jaya



David
Replied On March 18, 2009 09:10 AM



>Hi David,

Thank you for using Syncfusion products.

Please use the code snippet below to close the context popup if the entered string not matches the list.

[C#]

void editControl1_KeyUp(object sender, KeyEventArgs e)
{
string s = this.editControl1.GetCurrentWord();

if (s != "car" && s != "card" && s != "cardio")
{
this.editControl1.CloseContextChoice();
}
}

Please let me know if this helps you.

Regards,
Jaya




Thats how i would do it, but i want a more generic approach. Instead of having to write

!= "car" && s != "card" && s != "cardio"...

Which is very tedious, could i have something like s != editcontrol1.contextchoicecontroller.selectedItem.Text

or something similar.


David
Replied On March 18, 2009 06:02 PM

Its ok i think i've solved it. I just tested whether there was anything selected in the context popup, if not then close it...

private void editControl1_KeyUp(object sender, KeyEventArgs e)
{
if (editControl1.ContextChoiceController.IsVisible)
{
if (editControl1.ContextChoiceController.SelectedItem == null)
{
editControl1.CloseContextChoice();
}
}
}

Thanks.


Administrator [Syncfusion]
Replied On March 19, 2009 12:23 AM

Hi David,

Thanks for the update.

Please let me know if you have any further questions.

Regards,
Jaya



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.

;