Solved

Lost Focus on showDialog (Windows Application)

Posted on 2004-09-15
7
2,842 Views
Last Modified: 2009-06-08
I'm developing a windows aplication that starts in a main form and when user selects FILE/NEW PROJECT, a wizard is displayed (in modal way). This wizard is a sequence of forms displayed with showDialog. Each step of the wizard has a NEXT button and a BACK button. The code is like these:

When FILE/NEW PROJECT menu of main form is selected:
step1Form.showDialog();

When NEXT button of step 1 is pressed:
step1Form.hide();
step2Form.showDialog();

When NEXT is pressed, the main form lost focus for any windows aplication running (word, excel, explorer, IE, etc...) and the step2Form appears in front of it. Now, we have my main form hidden by a windows application and the step2 form in front of the windows application. There's a file sample in:

This is the original error!
http://www.tecgraf.puc-rio.br/~nazareth/code/TesteBugShowModalErro.zip

This is a try to solve it (not good yet)!
http://www.tecgraf.puc-rio.br/~nazareth/code/TesteBugShowModalMelhor.zip

Anybody knows how can fix it?
Thanks!

ps. sorry about my english, i'm brazilian ;)



0
Comment
Question by:Gonella
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 5

Expert Comment

by:tomasX2
ID: 12070018
try...
step1Form.hide();
step2Form.showDialog(this);
0
 
LVL 8

Expert Comment

by:AaronReams
ID: 12070456
You might consider saving yourself a lot of time by using an existing wizard in your code...

http://www.codeproject.com/cs/miscctrl/tswizard.asp

http://www.codeproject.com/cs/miscctrl/ak_wizard.asp

http://www.codeproject.com/cs/miscctrl/DesignTimeWizard.asp

There's many more out there also... good luck.

Cheers,
Aaron

0
 

Author Comment

by:Gonella
ID: 12071693
AaronReams, thanks for the tip but I won't use a 3rd party wizard in this project because I need total control on this forms and all of its design and code is already done.

TomasX2, the problem occurs when the hide() is called, so, I think that nothing after hide() will make some difference, but I tryed your solution and didn't work.


0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Accepted Solution

by:
sideb earned 500 total points
ID: 12074176
Como voce é brasileiro, ai vai....

Uma sugestão, voce poderia usar paineis ao invés de usar vários forms.

Em cada painel teria a sua "tela" e voce iria ocultando e exibindo a cada etapa.

Espero ter ajudado.

0
 

Author Comment

by:Gonella
ID: 12075170
SideB, your idea of using panels to do the steps is a nice one, but I think there's a way to show a sequence of dialog forms without lose the focus. I'm probably missing something...

Using panels make de interface management more dificult...

Thank you anyway, I will try it later.
0
 
LVL 5

Expert Comment

by:tomasX2
ID: 12075648


I think the showDialog with the IWindow32 parameter tells the form who the parent is...
when you created the step1 form from the main form did you create it with a step1Form.showDialog(this) overload or just the regular...

I tried this at home yesterday and I did it like this and it worked out better than without the overload.

// main form
step1Form = new Form2();
step1Form.showDialog(this);

// step one form on next click...
this.Hide()
step2Form = new Form3()
step2Form.showDialog(this);

// step two on back
this.Hide()
step1Form = new Form2();
step1Form.showDialog(this);
0
 

Author Comment

by:Gonella
ID: 12076622
tomasX2, the results of your code is almost good, in fact, much better than without overload, but it still with a strange behavior, like a flick when the hide() is called. I got something like this in the example I posted at:

http://www.tecgraf.puc-rio.br/~nazareth/code/TesteBugShowModalMelhor.zip

I need smooth transition between forms, any idea?

Thank you for the help.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sent email using Shared Mailbox from outlook in C# 5 83
Amazon S3 .Net error 5 43
Adding where clause to entity statement c# 1 49
Nested forach loop to linq 3 30
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question