Unplanned
Last Updated: 13 May 2020 05:42 by ADMIN
Jason
Created on: 29 Apr 2020 22:52
Category: MessageBox
Type: Bug Report
1
RadMessageBox.Show does not center the MessageBox when I pass my application's main window as the parent. The RadMessageBox is displayed in the upperleft corner of the screen.

Here's the call I'm making. The ApplicationWindow property type is IWin32Window.  It is coming from an application that inherits from CWinApp.  The message is displayed in the upperleft corner of the screen.

RadMessageBox.Show(gtApp.ApplicationWindow, Resources.SpatialQueryNoRecords, app.Name, MessageBoxButtons.OK, RadMessageIcon.Info);

A similar MessageBox call centers on my application just fine:

MessageBox.Show(gtApp.ApplicationWindow, Resources.SpatialQueryNoRecords, app.Name, MessageBoxButtons.OK, MessageBoxIcon.Information); 

3 comments
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 13 May 2020 05:42
Hello, Jason, 

The provided sample project is greatly appreciated. I was able to observe the top left location of RadMessageBox when the RadForm is not visible. Indeed, when using the MS MessageBox, it is being centered on the screen.

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  to eliminate the top left location is to manage the RadForm.Opacity property instead of the Visible property. Thus, the message is expected to be centered within the form: 

            this.Opacity = 0;
            ApplicationWindow window = new ApplicationWindow(GetDesktopWindow());
            RadMessageBox.Show(window, "Message", "Caption", MessageBoxButtons.OK, RadMessageIcon.Info);
            this.Opacity = 1;

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Jason
Posted on: 06 May 2020 15:57

I have updated your sample app to try and simulate what I'm experiencing.  The attached project is not exactly my scenario, but it shows the RadMessageBox displaying in the upper left corner of the screen when the IWin32Window parent parameter is not a RadForm (and when there is no RadForm displayed). The standard MessageBox displays in the middle of the DesktopWindow - the window being passed as the parent in the sample app.

In my actual scenario my application's HWND (actually a CFrameWnd's HWND) is cast to an IntPtr and passed to the ApplicationWindow's constructor. There is no RadForm displayed in my production scenario either.

 

 

ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 06 May 2020 12:53

Hello, Jason, 

RadMessageBox is intended to be centered according to the specified parent. Otherwise, it is centered on the screen.

Following the provided information, I was unable to reproduce the issue you are facing. Please refer to the below screenshot illustrating the behavior on my end with the specified version. I have attached my sample project. Could you please specify the exact steps how to reproduce the problem? Feel free to modify it in a way to reproduce the experienced issue and get back to me with it so I can investigate the precise case. Thank you in advance. 

I am looking forward to your reply.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.