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. Image for the cookie policy date

SplashPanel and control focus

We used the SplashPanel to implement a custom Messagebox (similar to the standard windows MessageBox.Show ()) but with a custom look. The only problem I am having is the idea of setting a "default" button. That is, if you have a "Yes" and "No" button (say, button1 and button2 respectively) on the panel. And you want the "No" (button2) to be the default button. This behaivor exists in the MessageBox class by way of the DefaultButton enum. I set the focus on the buttons like this: case MessageBoxDefaultButton.Button1: default: button1.Focus (); break; case MessageBoxDefaultButton.Button2: button2.Focus (); break; case MessageBoxDefaultButton.Button3: button3.Focus (); break; Except this doesn''t work, neither does button2.Select (). All three buttons are ButtonAdv controls. I suspect it could be because the splash panel is not a form (MSDN Doc states: "the control must be a form or the control''s outermost parent must be a form." in refernce to the Control.CanFocus property which is always false) Is there any other way to set what control has focus when the panel is shown? Or any way to trick the buttons into thinking their parent control is a form not a panel? When i show the Splash panel, I use ShowDialogSplash (null) (passing in a valid Form object doesn''t seem to make a difference). Any suggestions would be greatly appreciated! Thanks, Jonathan

4 Replies

AR Anupama Roy Syncfusion Team July 7, 2006 07:01 AM UTC

Hi Jonathan, Inorder to set the focus to the desired button on a SplashPanel,I tried with this.buttonAdv1.Select (); and it works fine here.You can have a switch case as mentioned and can have multiple choice also between the buttons as you wish. Could you please take a look at the sample attached and let us know if you have any difficulties. Sample Thanks for choosing Syncfusion products. Regards, Anu.


AR Anupama Roy Syncfusion Team July 7, 2006 11:51 AM UTC

Hi Jonathan, If you have any difficulties,could you please mention the EssentialStudio version that you are working with. Thanks, Anu.


JQ Jonathan Quail July 7, 2006 07:23 PM UTC

Perfect! That fixed the issue. I wonder if my problem initially was that I was trying to set the focus on the button before calling "ShowDialogSplash (null)". Even with button2.Select () it didn''t work until I placed that code into the BeforeSplash event handler - then it worked with no issues. Thanks again! > >Hi Jonathan, > >If you have any difficulties,could you please mention the EssentialStudio version that you are working with. > > >Thanks, > >Anu. >


AR Anupama Roy Syncfusion Team July 10, 2006 04:37 AM UTC

Hi Jonathan, Thanks for the update. Regards, Anu.

Loader.
Live Chat Icon For mobile
Up arrow icon