Minimize and reuse a dialog

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
wells50
Newbie
Posts: 14
Joined: Sat Mar 04, 2006 9:58 pm
Location: Edina, Minnesota USA
Contact:

Minimize and reuse a dialog

Post by wells50 » Fri Feb 25, 2011 3:48 pm

I am working on an app that is compiled as an .exe file. I would like the app to display a dialog with, say, 3 buttons and a Close button. Pressing any one of the 3 buttons performs a related task, such as setting focus on a Window and entering some test.

After the user presses one of the 3 buttons, is it possible to minimize the dialog (or at least leave it up behind the current window) so that the user can return to it later to press another button to perform another task? When the user is done using the app, pressing the Close button closes it.
Wells H. Anderson
Active Practice LLC

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Feb 25, 2011 4:06 pm

Yes. You could even hide it. But I'm not sure that you even need to do that. Even if you close it, it is still available to use again - you just need to Show it again when the user needs it.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

wells50
Newbie
Posts: 14
Joined: Sat Mar 04, 2006 9:58 pm
Location: Edina, Minnesota USA
Contact:

Post by wells50 » Fri Feb 25, 2011 4:36 pm

How do you hide a Dialog? Would I use:
SetDialogProperty>Dialog1,frmDesign_1,Visible,False ?
I assume I would need to use that code in the actions for each of my 3 buttons. But then I am not sure how the user could get back to the dialog. If I make the dialog visible again when a button's actions finish, wouldn't the dialog get the focus? I am hoping to leave the dialog behind the current window and accessible by clicking its icon on the Windows taskbar.
Also, if the user closes a Dialog, I understand that it is still available to be displayed with Show>Dialog1, but how do I keep the app from simply running to the end of the code and terminating when the user closes the Dialog? I want the app to terminate when the user clicks the Close button or the red X close control in the upper right corner.
Thank you for the very fast response to my first post!
Wells H. Anderson
Active Practice LLC

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Fri Feb 25, 2011 10:21 pm

Like so...

Code: Select all

//Hide the dialog
SetDialogProperty>Dialog1,,Visible,False

//Show the dialog
SetDialogProperty>Dialog1,,Visible,True

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Mon Feb 28, 2011 3:27 pm

Also make sure the Close button is the only one with "ModalResult" defined.
Thanks,
Jerry

[email protected]

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Visible Property not returning correctly

Post by kpassaur » Wed Aug 31, 2011 8:03 am

I have had issuses when hiding dialogs and I still am. The issue is that when the Dialog returns it is not in the same position. First off the issue could be related to double monitors, I am not sure.

I have the Dialog set to open on the desktop centered, however with double monitors you need to drag it to one or the other. The user of this will not necessarly have double monitors. So it is acceptable to have it this way.

What happens is once I set the visible property to false it correctly hides it. When I set it back to true, only a portion of it reapears and I have to drag it back to where it was.

I believe it is not really being hidden, just moved off the desktop; however when it returns it needs to go to the last position.

Anyway, that is what is happening to me, is anyone else having this issue?

User avatar
JRL
Automation Wizard
Posts: 3529
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Aug 31, 2011 12:33 pm

If I run this script I get a blinking dialog that maintains its position. Every time I start teh script the dialog shows up in a new place. But while the script is running the dialog does not move.

Code: Select all

Dialog>Dialog1
EndDialog>Dialog1

Show>Dialog1
Wait>1
SetDialogProperty>Dialog1,,Visible,False

Wait>1
SetDialogProperty>Dialog1,,Visible,True

Wait>1
SetDialogProperty>Dialog1,,Visible,False

Wait>1
SetDialogProperty>Dialog1,,Visible,True

Wait>1
SetDialogProperty>Dialog1,,Visible,False

Wait>1
SetDialogProperty>Dialog1,,Visible,True

Wait>1
SetDialogProperty>Dialog1,,Visible,False

Wait>1
SetDialogProperty>Dialog1,,Visible,True

Wait>1

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Moves for me

Post by kpassaur » Wed Aug 31, 2011 12:59 pm

For me when it becomes visible only about 25% of it can be seen. I am using the exact same commands (naturally there is different code inbetween them). All I can think of is it has to do with the dialog that comes up when the fist one is hidden.

I just tested your sample and it worked correctly on my machine so it is not the dual monitors.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts