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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I close ContextChoice programmatically?

Thread ID:

Created:

Updated:

Platform:

Replies:

52078 Nov 21,2006 02:52 PM UTC Feb 2,2007 02:36 AM UTC WinForms 11
loading
Tags: EditControl
Administrator [Syncfusion]
Asked On November 21, 2006 02:52 PM UTC

How can I close ContextChoice programmatically?

Administrator [Syncfusion]
Replied On November 23, 2006 04:54 PM UTC

Hi ok,

Our apologies for the delayed response. It is possible to close ContextChoice programmatically using the CloseContextChoice method. This method is included in the beta version of 4.4. I have attached a sample that illustrates this. Let me know if this meets your requirements.

Thanks for your patience.

Regards,
Ebenezer.P

sample



Administrator [Syncfusion]
Replied On November 24, 2006 08:04 AM UTC

Excellent! But I use version 4.302.0.30

Administrator [Syncfusion]
Replied On November 28, 2006 01:36 PM UTC

Hi ok,

Our apologies for the delayed response. It is possible to hide the ContextChoice using the FormSize property of ContextChoiceController. I have attached a sample that illustrates this. Let me know if this meets your requirements.

Thanks for your patience.

Regards,
Ebenezer.P

sample

David Union
Replied On December 1, 2006 08:41 PM UTC

This doesn't actually work.
It doesn't close the ContextChoice, it hides it by making the size small. The problem is that it's still there. So if you for example hit a down arrow and enter, you *get the text* in the context prompt, which is going to be the oddest behavior a user ever sees in the editor.

Is there a way just to 'cancel' this context choice box, that is fire off a cancel or a closecontextchoice event or something like it?


>Hi ok,

Our apologies for the delayed response. It is possible to hide the ContextChoice using the FormSize property of ContextChoiceController. I have attached a sample that illustrates this. Let me know if this meets your requirements.

Thanks for your patience.

Regards,
Ebenezer.P

sample

Administrator [Syncfusion]
Replied On December 6, 2006 07:44 PM UTC

Hi dunion,

Our apologies for the delayed response. It is possible to close ContextChoice in version 4.4 using the CloseContextChoice method. It is also possible to cancel the ContextChoice using the ContextChoiceBeforeOpen event. I have attached a sample that illustrates this. Let me know if this meets your requirements.

Thanks for your patience.

Regards,
Ebenezer.P

sample

Administrator [Syncfusion]
Replied On January 20, 2007 08:04 PM UTC

I've been able to cancel the ContextChoiceBeforeOpen event successfully to prevent a context choice from dropping down but I don't always know upfront if I'll need to cancel it. Because of this, I need to be able to close (or cancel) the context choice dialog from inside of the ContextChoiceOpen event. I've tried calling the CloseContextChoice method you've mentioned but it doesn't seem to work inside of a ContextChoiceOpen even handler. Any suggestions?

thanks,
Travis

David Union
Replied On January 30, 2007 05:30 PM UTC

In theory they have a fixed version that claims you can close this from the ContextChoiceBeforeOpen() handler, which I have but I haven't tried this feature yet, there are too many other issues I'm trying to deal with. My earlier (successful) work-around was to start a timer and exit, then catch the event in the timer and close the contextprompt in the timer-handler and then execute the remainder of the code I needed there.

>I've been able to cancel the ContextChoiceBeforeOpen event successfully to prevent a context choice from dropping down but I don't always know upfront if I'll need to cancel it. Because of this, I need to be able to close (or cancel) the context choice dialog from inside of the ContextChoiceOpen event. I've tried calling the CloseContextChoice method you've mentioned but it doesn't seem to work inside of a ContextChoiceOpen even handler. Any suggestions?

thanks,
Travis

Administrator [Syncfusion]
Replied On January 31, 2007 03:07 PM UTC

private bool CloseContextChoice()
{
if (edCode.ContextChoiceController.IsVisible)
{
edCode.KeyBindingProcessor.ProcessKey(Keys.Escape);
return true;
}
return false;
}

Purusothaman R [Syncfusion]
Replied On February 1, 2007 06:26 PM UTC

Hi Olga,

The KeyBindingProcessor.ProcessKey(Keys.Escape) does not work in the ContextChoiceOpen event, since the Context Choice is not displayed. It works only after the Context Choice is displayed.

You can use the FormSize of the ContextChoiceController to obtain the desired behavior.

this.editControl1.ContextChoiceController.FormSize=new Size(0,1)

I am attaching a sample here which demonstrates the same. If this is not you needed, kindly modify the sample to show what is your actual need.

ContextChoiceSample

Thanks,
Purusothaman.R

Administrator [Syncfusion]
Replied On February 1, 2007 08:05 PM UTC

FYI I had previously tried the form-size method but the problem was that the context list still had focus and it was easy for items from that list to get 'dropped' onto the edit window in a way that would appear 'odd' to the user. Maybe clear the Items array first?

>Hi Olga,

The KeyBindingProcessor.ProcessKey(Keys.Escape) does not work in the ContextChoiceOpen event, since the Context Choice is not displayed. It works only after the Context Choice is displayed.

You can use the FormSize of the ContextChoiceController to obtain the desired behavior.

this.editControl1.ContextChoiceController.FormSize=new Size(0,1)

I am attaching a sample here which demonstrates the same. If this is not you needed, kindly modify the sample to show what is your actual need.

ContextChoiceSample

Thanks,
Purusothaman.R

Purusothaman R [Syncfusion]
Replied On February 2, 2007 02:36 AM UTC

Hi David,

To overcome the issue mentioned by you, I have cleared the Items in the Context Choice.

I have a check box in the sample to decide whether to show the ContextChoice or not. A flag variable is used to detect the "Enter" key in the sample to get the default behavior of moving to the next line when Enter key is pressed.

Please look in to the sample.
ContextChoice.zip

Thanks,
Purusothaman.R

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.

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

;