MDI Client Problem

G

Guest

Continues - Clicking a button and pressing Enter key act different in MDI.

Jeffrey
It's not a new problem. I think I described a problem where the client
didn't fill properly. I thought it was due to a open/save dialog being
displayed. After I got the other workarounds in, I found that the same
problem happened anytime the Activated Sub ran for a long time (when the open
dialog was displayed, Activated did run for a long time). What I did was
start a timer with a 1/2 second interval and moved all the code that could
run for a long time into the TimerEventProcessor Sub. My conclusion is that
the client can't "fill" until Activated completes.

What do you think about the Show problem. That is, if you Show Client1 and
then Show Client2 the form that is displayed is Client1 and not Client2.

Now if we could only get rid of the flicker...
 
J

Jeffrey Tan[MSFT]

Hi tsiGeorge,

Thanks for your new posting!!

I think this is a new problem, which we did not work on in original
post(Only with some mention in the last reply in original post). Can you
attach a brand new sample project with some details steps to reproduce the
problem? Then we can address the root cause better and more accurate.

I will wait for your further feedback. Thanks
===========================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi tsiGeorge

Have you managed to create out a new sample project? Is your problem
resolved? Please feel free to tell me, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

Jeffry,
Sorry, I missed your post.

To see the problem, just add an OpenFileDialog to one of the screens and
then add "OpenFileDialog1.ShowDialog()" in the Activated Sub just before the
Exit Sub. Then watch how that client is displayed. Once you close the Open
File Dialog window the client is displayed correctly. If after you open the
file there is a function that takes a long time (in our App we could end up
adding 100,000 records to SQL database and that takes about 4 minutes)
things look even stranger. You can see part of the Open File dialog window
and there is a gap at the top of the client window.
 
J

Jeffrey Tan[MSFT]

Hi tsiGeorge,

Thanks for your feedback!!

Yes, after following your statement, I placed a OpenFileDialog in a MDI
Child form, which is invoked in Form3_Activated event, and when the dialog
is opened up, the background MDI Child is in a not maximized(Dock Fill)
state, while closing the dialog will end up with the maximized state.

Winform application is a single thread Win32 SDK program wrapper, when we
set Form.DockStyle to Fill, the Fill operation may result in several
WM_SIZE messages, while in the process, a WM_ACTIVE message is sent to the
Form's WndProc, and causing Actived event to be fired. While the
OpenFileDialog is a model dialog, which will block its parent Form's
message processing.
At last these messages/events orders are not defined and undocumented,
which we should not reply on.

I think your current concern is how to place some long time processing
code/(model dialog) in the form actived event, so that everytime the dialog
is actived, your long time initializing code will be executied. At the same
time, it will not block the UI maximize operation.

I think the best solution for this situation is using multi-threading, so
we can place the long time processing code in another thread, then the main
UI thread will not be blocked and processing correctly. Sample code snippet
lists below:
Sub DoWork()
OpenFileDialog1.ShowDialog()
End Sub

Private Sub Form3_Activated(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Activated
iCnt3 += 1
txtBox.Text = iCnt3
txtBox.Focus()
Dim t As System.Threading.Thread = New
System.Threading.Thread(AddressOf Me.DoWork)
t.Start()
End Sub

Note: for multi-threading in Winform, we should take care of the
inter-thread communication. You may search "Safe, Simple Multithreading in
Windows Forms" in MSDN for 3 Winform multi-threading articles.

Hope this helps.
=====================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top