BUG: Overlay and radmessagebox do not work together

1 Answer 177 Views
MessageBox Overlay
Troy
Top achievements
Rank 3
Bronze
Iron
Iron
Troy asked on 01 Jan 2023, 05:32 AM

Here is some sample code:

Imports Telerik.WinControls
Imports Telerik.WinControls.UI

Public Class RadForm1
    Private Sub RadForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        RadOverlayManager.Show(Me)
        For x = 0 To 1999999999

        Next
        RadOverlayManager.Close()
        RadMessageBox.Show("You will never see this.", "Nope", MessageBoxButtons.OK, RadMessageIcon.Info)
    End Sub
End Class

What you'll see is, the overlay will appear and disappear as expected.  However the radmessagebox will never appear. 

If you comment out the overlay lines, then the message box will appear.

Looks like a threading issue, but I'll leave that to the professionals to figure out. =)

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 02 Jan 2023, 09:26 AM

Hi Troy,

Thank you for the provided code snippet.

I have tried to reproduce this behavior on my side but to no avail. The message box will appear after the overlay screen is closed. May I ask you to check the attached project and let me know what I am missing from your setup? 

I look forward to your reply so I can further assist you.

Regards,
Dinko | Tech Support Engineer
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 02 Jan 2023, 06:38 PM

Hmm, that doesn't make much sense then as I created a new VB Winforms project using the Telerik template for that.  I found the problem in the app I'm working on, and then was able to reproduce it in the sample app.

However... after trying my sample app today (I've since rebooted), its working.  However, it isn't working totally as expected as now the popup for the radmessagebox pops up, but it is appearing under my app window as well as under the VS Studio app.

Dinko | Tech Support Engineer
Telerik team
commented on 03 Jan 2023, 10:50 AM

Thank you for the additional details.

I have double-checked the project and you are right that the RadMessageBox appears under VS app but not under your application. Generally speaking, the application is still not shown in the Load event of the form. When the overlay screen is shown it stills the focus and deactivates the form. When the overlay is closed the form is still not activated. That is why the message box appears under VS. To make this work you can force activating the form by calling the Activate() method of the Form.

private void Form2_Load(object sender, EventArgs e)
{
    RadOverlayManager.Show(this);
    for (var x = 0; x <= 1999999999; x++)
    {
    }
    RadOverlayManager.Close();
    this.Activate();
    RadMessageBox.Show( "You will never see this.", "Nope", MessageBoxButtons.OK, RadMessageIcon.Info);
}

As a side note, the purpose of the overlay is to be shown on top of the control and notify the user of the long-running operation is performing. As in your case, you want to show the user that the application is loading, a better approach here is to use RadSplashScreen. You can also customize its content per your needs. Check the Customize Splash Content help article for more information.

Troy
Top achievements
Rank 3
Bronze
Iron
Iron
commented on 04 Jan 2023, 03:19 AM

Thanks for the response, I think understand what you mean.

One question, I have multiple forms that may be opened by the user.  They can take a few seconds to load due to retrieving data, so I wanted to use the overlay on them (not just the startup form, any form).  I get what you mean about the splash screen and that'll work for the app load.  But I can't get it to work when opening another form.  Here's an example of what I'm doing:

    Private Sub frmRemoteLogViewer_Shown(sender As Object, e As EventArgs) Handles Me.Shown
        RadOverlayManager.Show(Me)
        GetFileList()
        RadOverlayManager.Close()
        Me.Activate()
    End Sub
I've tried various events, but I think the shown even is the final one on display of the form.  But I can't get the overlay to appear.  My guess is that this is the same problem as before.  In which case, it doesn't appear that using the overlay is a good idea on form loads (unfortunately, that's the primary place I need it, loads and close).
Troy
Top achievements
Rank 3
Bronze
Iron
Iron
commented on 04 Jan 2023, 03:46 AM

So I switched to the splash screen instead of overlay and that's working as expected.  I didn't choose it initially because I really just wanted a simple spinner while the wait was happening, and didn't need all of the other functionality the Splash Screen has.  However, switching to it, in my use case, fixed the issues I've been having.  So... Slash Screen for for load events... =)  Thanks for your help!
Tags
MessageBox Overlay
Asked by
Troy
Top achievements
Rank 3
Bronze
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or