Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Lost Focus on showDialog (Windows Application)

Posted on 2004-09-15
7
Medium Priority
?
2,992 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 1

Accepted Solution

by:
sideb earned 2000 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

Industry Leaders: 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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

604 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