Forum  Core :: SDK (Vi...   Let's Chat Abo...  MessageBox bugs
Previous Previous
 
Next Next
New Post 12/11/2008 7:35 AM
  wjar
49 posts
No Ranking


MessageBox bugs 

There are a couple of bugs I found with MessageBoxes, though I'm not completely sure of how they work.

1) When showing a messagebox from a form just before closing it, it doesn't appear on screen.

2) I don't know how to explain this one, look for it in the sample.

http://www.rapidshare.com/files/172426978/WebGUIApplicationTestMessageBox.rar

 
New Post 12/11/2008 8:59 AM
  palli
11824 posts
1st Level Poster




Re: MessageBox bugs 

Hi !

I think both of your problems are explained by the fact how VWG is designed. You have to think of it as a kind of two seperate processes. Say you are running something like the following two psaudo-code lines in a handler, like the button click handler:

a) MessageBox.Show("something")

b) DoSomethingQuiteDifferent()

Ok, This code is running on the server, so the server processes the a) line and here is where most of us drop out and think as it's a messagebox then it will show immediately in the browser, but that does not happen. The server continues to the end of the handler and finishes the b) line before something starts happening in the browser.

I think this is best eplained by referencing your sample app. Take a look at frmChildForm and the button click handler, because there is where you make this common logical error. Your code is:

        private void btnLastMessageBox_Click(object sender, EventArgs e)
        {
            MessageBox.Show("This MessageBox never appears on screen, no matter what you do.",

                            "Test", MessageBoxButtons.YesNo, new EventHandler(MessageBox_Close));

            if (OnCloseFunction != null)
                OnCloseFunction();
            this.Close();
        }
 

What happens here is the server processes (runs) the MessageBox.Show() and then BEFORE anything happens on the client, it calls the OnCloseFunction delegate, which should display another messagebox and then finally it calls this.Close()... all this is done BEFORE anything has a chance to be reflected in the browser.

Finally the server starts reflecting the changes to the browser, but as you allready closed the form in the handler, there is actually nothing to do other than just close the form ... this is probably a VWG design issue, that MessageBox windows are some kind of "child" of the main window, so when the main window (your frmChildWindow) is allready closed, it will not display the messagebox.

I think you'll have a good time :-) figuring out the other stuff, but to make the "This MessageBox never appears on screen..:" messagebox actually show on screen, just move this code:

            if (OnCloseFunction != null)
                OnCloseFunction();
            this.Close();

From the button click handler to the MessageBox_Close() event handler and then it will work.

Hope this explains the actual meaning of "... Modal windows in VWG are only modal on the client ..." statement that so often has been thrown on the forums :-)

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 12/11/2008 9:08 AM
  wjar
49 posts
No Ranking


Re: MessageBox bugs 

I knew all that, it's just that if I close the child form it shouldn't close the message box too. As for moving the code, that defeats the purpose of having an OnCloseFunction if you don't do it just before you close; I don't want the messagebox to appear while the form is still there.

Also, there's the rest of the message boxes that don't show up.

 
New Post 12/11/2008 9:12 AM
  palli
11824 posts
1st Level Poster




Re: MessageBox bugs 

Hi !

I think there is similar explaination to all of this. To not defeat the purpose of OnCloseFunction, then just move the this.Close() down to the messageboxhandler function. Then you will not have closed the form before the messagebox is show.

Does that work for you?

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 12/11/2008 9:45 AM
  palli
11824 posts
1st Level Poster




Re: MessageBox bugs 
Modified By palli  on 12/11/2008 1:46:05 PM)

Hi !

Sorry, I didn't read all of your comment. You don't want the child window on screen when the messagebox is shown...

Well, that is simple. You throw in this.Visible = False at the start of your button handler, move the this.Close() down to the Messagebox handler, and then you get you OnCloseFunction logic.

Does that work for you?

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  Core :: SDK (Vi...   Let's Chat Abo...  MessageBox bugs
Assessment Bottom
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS