RadmessageBox default button focus

1 Answer 94 Views
MessageBox
Troy
Top achievements
Rank 3
Bronze
Iron
Iron
Troy asked on 23 Aug 2022, 02:50 AM

I did a search and found this thread from... 13 years ago: https://www.telerik.com/forums/radmessagebox-focus-on-buttons-in-mdi-app

Wasn't sure if I should necro it or not, but regardless, is there a way around this?  For example, when I do a .Show on it I expect it to have focus and also that a button on there have focus.  Especially if its just an "ok" button, as with the default .NET msgbox I could just hit the spacebar to continue.  As it is, you HAVE to use your mouse to select the button.

Also, there's no TAG for the radmessagebox here on the forum so I used "messageBox"

1 Answer, 1 is accepted

Sort by
1
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 23 Aug 2022, 02:23 PM

Hello, Troy,

I have tested the following cases:

        private void radButton1_Click(object sender, EventArgs e)
        {
            RadMessageBox.Show("Test", "Caption", MessageBoxButtons.OK);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Test", "Caption", MessageBoxButtons.OK);
        }

In both cases, the shown message box is closed after pressing the Spacebar. Could you please provide more details about the exact setup you have on your end which leads to the undesired behavior?

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Troy
Top achievements
Rank 3
Bronze
Iron
Iron
commented on 23 Aug 2022, 03:48 PM

Tess, this is an example of what I'm using:
RadMessageBox.Show(Me, result.desc, "Deployment Result", MessageBoxButtons.OK, RadMessageIcon.Info)
The only other thing that I can think of is that I'm using a theme?  I started with I think it was the Office 2019 Dark theme, although to be honest I don't remember anymore.
Dess | Tech Support Engineer, Principal
Telerik team
commented on 26 Aug 2022, 07:33 AM

Hi, Troy,

Indeed, when the RadMessageBox is shown passing the owner, pressing the Spacebar doesn't click the default OK button. This is because the form Instance that hosts the message box, is not TopMost. This is a part of the code of the internal implementation:

            if (Instance.Owner != null)
            {
                Instance.TopMost = Instance.Owner.TopMost;
            }
 

I have logged it in our feedback portal by creating a public thread on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to make the parent form TopMost. 

            this.TopMost = true;
            RadMessageBox.Show(this, "Test", "Deployment Result", MessageBoxButtons.OK, RadMessageIcon.Info); 

 

Troy
Top achievements
Rank 3
Bronze
Iron
Iron
commented on 27 Aug 2022, 01:49 AM

That solves the issue, I appreciate your looking into it.

Thanks as always!

Tags
MessageBox
Asked by
Troy
Top achievements
Rank 3
Bronze
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or