Forum  Commercial Foru...  Commercial Foru...  [6.4d] DialogResult getting modified by WebGUI not by code
Previous Previous
 
Next Next
New Post 4/9/2012 3:51 PM
  dmcgrail
274 posts
4th Level Poster


[6.4d] DialogResult getting modified by WebGUI not by code 
Modified By dmcgrail  on 4/9/2012 7:01:55 PM)

1. Create a New Application

2. Within this app, add a new item - a Form (so Form2.cs)

3. On Form2.cs add two buttons - wire up click events for both.

4. Form2 code will look like this:

        public Form2()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

5. On Form1, drop a Button on it and wire up the Click event.

6. Form1 code will look like this:

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form2 f = new Form2();
            f.Closed += new EventHandler(f_Closed);
            f.ShowDialog();
        }

        void f_Closed(object sender, EventArgs e)
        {
            using (Form2 f = sender as Form2)
            {
                MessageBox.Show(f.DialogResult.ToString());
            }
        }

7. Set Specific Page to Form1.wgx, save, compile, run.

Put breakpoints in both of the click events in Form2.  When form1 is presented, click the button (Form2 will appear).

Then, click any of the buttons on Form2.  You will hit a breakpoint and you can see that this.DialogResult = None.

But, when you return to Form1, the MessageBox says Cancel.

BUG: Somehow, WebGUI is modifying the DialogResult.  I don't believe you should do that.

Here's how I found that and why:

Our main app has a tab control on it.  Each tab gets a User Control added to it at run-time.  The particular user-control has a DataGridView on it and some toolbars.  From the toolbar I click the "Add new item" button which brings up a Maintenance Dialog.  Typically, in the OK Click event (there's an OK button and a Cancel button), you will see code that looks like this:

if (!ValidateControlsOnThisMaintenanceForm())

{

     return;  // The Validate function actually pops up a MessageBox warning them of data entry errors.

}

WriteValidDataToDatabase();

this.DialogResult = DialogResult.OK;

this.Close();

In my testing, I just opened the Maintenance dialog, did nothing else (no typing in any of the textboxes, combos, etc), just clicked OK, and the form returned.  It would usually warn me that field 1 was empty and that wasn't allowed.

I debugged the code and it got into our Validate code, I saw that MessageBox.Show was called, I saw that it returned before getting to the WriteValidDataToDatabase function and the this.Close call ...

but the Form actually closed.  No MessageBox.  It just closed.  All of my Maintenance forms are now useless if they aren't going to work right.  It should have never closed, this.Close() was never called.  A MessageBox should have appeared.

I'm in the middle of trying to figure out the exact amount of code I need to add to a TestProject to duplicate this, I haven't yet, but I did just notice that WebGUI is changing None to Cancel so I posted it here.  I'm sure you will get more, especially the major bug I'm trying to track down.

FYI, I've now tried two things since I made the switch to 6.4d (and I created a brand new VM for this, and made a copy of our code and built that using 6.4d):

a. To log-in

b. A random Maintenance Tab, popped open a maintenance dialog, clicked OK (expecting a MessageBox).

That's the only tests I've run and both failed.  I don't think 6.4d is ready for prime-time.

EDIT:

And can someone tell me how to stop double-spacing while making this post?  Look at the code that I typed isntead of cutting-and-pasting from somewhere else.  It's all double-spaced for no reason.  Also, what are the tags to make source code look like source code?

 
New Post 4/10/2012 11:32 AM
  palli
14313 posts
1st Level Poster




Re: [6.4d] DialogResult getting modified by WebGUI not by code 

Hi Dan,

According to my testing, setting DialogResult to Cancel is the correct behaviour and the same behaviour you will see in Windows Forms. This setting of DialogResult=Cancel occurs only when closing and the DialogResult has the value None. If it has any other value, no resetting will occur.

When pasting code, if you are using VS2010, I recommend you install the Productivity Power Tools extension as it's HTML Copy will allow you to copy your code from within VS2010 and then paste it into the forum editor as Html with highlighting and all. That's the one I use when pasting code from VS2010. Similar tool is also available for VS2008.

Hope this helps,

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 4/10/2012 12:05 PM
  dmcgrail
274 posts
4th Level Poster


Re: [6.4d] DialogResult getting modified by WebGUI not by code 

Yeah, I should have checked first.

I've been pulled into some issues that need to get fixed, so I haven't been able to produce a test project that shows my major concern (dialogs that close for no reason) ... I think what I was hoping was that the DialogResult change was somewhat related and you guys might be fixing "something" while I'm putting out fires and then eventually putting together a test project.

Thanks again.

 
New Post 4/10/2012 2:26 PM
  palli
14313 posts
1st Level Poster




Re: [6.4d] DialogResult getting modified by WebGUI not by code 

Hi Dan,

You are welcome and good luck.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  Commercial Foru...  Commercial Foru...  [6.4d] DialogResult getting modified by WebGUI not by code
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS