Is there a way to redraw/resize a dialog box?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
sarver311
Pro Scripter
Posts: 84
Joined: Tue Jun 17, 2008 6:37 pm

Is there a way to redraw/resize a dialog box?

Post by sarver311 » Thu Apr 09, 2009 6:45 pm

Hey Guys

I was playing around with something which didn't seem to work. I have a feeling it doesn't but here is a little example.

In my dialog I havea listbox that I want to have hidden unless a radio button is checked so i set the following vars a the beginning.

let>listboxwidth=0
let>listboxheight=0

Then for example i have a listbox in my dialog

ListBox=testlistbox,152,24,%listboxwidth%,%ListboxHeight%,,

So I run my script, it loads the dialog settings and when I do a show>dialog2 it shows my dialog and my listbox is successfully hidden and those params are set to 0's. Now I set a trigger after the dialog is opened and I click a button to update the vars with the command.

let>listboxwidth=200
let>listboxheight=400

Using the debugger i know its updating the variables but getdialogaction>dialog2,r doesn't work nor does closing or reopening this dialog within this script. (this is secondary dialog to my main dialog). I would post a full example but I'm just confirming that I already fear is true. Is there a way to reload these variables other than telling my script to start all the way over? I hope that was clear and if you do want a full example i'll happily provide one.

Oh and I know about setdialogobjectvisible but unfortunately my version doesn't support that command and besides that I would like to make it so i can have my dialogs resized dynamically when more data gets in a listbox so its really a question more about resizing than hiding a dialog.

thanks!

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

Post by JRL » Thu Apr 09, 2009 7:22 pm

I believe you are correct. I don't know of a way to do what you are trying to do the way you are trying to do it.

However..... try THIS TECHNIQUE. You need to be able to use the libfunc> function that was introduced in version 7 or 8

You can resize your main dialog by using the ResizeWindow> function. It was introduced in version 5.

thinking about it... you might be able to resize the list box using resizewindow> and the objects handle... I haven't tried it and won't have time for a while. If you get that to work let us know.

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

Post by JRL » Thu Apr 09, 2009 7:31 pm

OK... so I couldn't wait to see if it worked.

And using resizewindow on the listbox object handle does resize the listbox.

Code: Select all

Dialog>Dialog1
   Caption=Dialog1
   Width=322
   Height=401
   Top=157
   Left=150
   ListBox=msListBox1,16,8,121,97,
   Button=msButton1,200,24,75,25,0
   Edit=msEdit1,24,272,121,msEdit1
   ProgressBar=msProgressBar1,24,344,150,16,0
EndDialog>Dialog1

Show>dialog1

Wait>3

Let>WIN_USEHANDLE=1
ResizeWindow>dialog1.msListBox1.handle,160,200
ResizeWindow>dialog1.msbutton1.handle,100,50
ResizeWindow>dialog1.msedit1.handle,180,50
ResizeWindow>dialog1.msprogressbar1.handle,180,2

mdl>

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Thu Apr 09, 2009 8:56 pm

Hi JRL,

Thanks for the above... I didn't know the ResizeWindow> command could be used to resize objects on a dialog... I never tried it as they aren't Windows.

Marcus, is this a perfectly valid use of the ResizeWindow> command?

If it is... then can an example (perhaps very similar to JRL's example above) be added to the ResizeWindow> topic in the Help File... and perhaps even a mention of this ability made in the Help File topic on Dialogs?

I think this is a very useful technique and unless its in the Help File somewhere... I think few people would ever discover it on their own.

Thanks again JRL... I am glad you are so curious.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

sarver311
Pro Scripter
Posts: 84
Joined: Tue Jun 17, 2008 6:37 pm

Post by sarver311 » Thu Apr 09, 2009 9:36 pm

JRL,

As always you are sooo helpful.

Thanks a bunch, this will work great for what I'm trying to do.

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 Apr 10, 2009 11:08 am

In Windows terminology many objects are windows or "windowed controls" and they work the same way. See:
http://www.mjtnet.com/blog/2009/02/19/v ... d-objects/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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