Refresh Image files in a Dialog

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Refresh Image files in a Dialog

Post by pgriffin » Thu Jun 22, 2006 3:38 pm

I have a dialog which pulls data from Access and displays the data in the dialog. Part of that data consists of 5 image files. I then allow the user to change the key search criteria, which should retrieve ALL new details. For some reason, everything refreshes BUT the image files.

I am using variables to store the names of the image files.
All image files are in the same directory.
The debugger shows that the value in the image variable is correct (but still displays the previous file)

I have not found this issue in any of the forums. I could post an example of the code, but it is quite large.

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

Post by JRL » Thu Jun 22, 2006 7:53 pm

Paul,

Some of the dialog settings once set are permanent. Width, height, top, left, caption are all fixed once you've defined the dialog. Apparently this is also true for the button and background images. Try something like this instead:

Hope this helps,
Dick

Edited for future references. Added If file exists, delete file. To remove file in the event of a script crash leaving the file behind.

Code: Select all

IfFileExists>c:\~dialogbmptest~.scp
  DeleteFile>c:\~dialogbmptest~.scp
EndIf
Let>k=0
Let>BMPfile=
Label>start
Add>k,1
WriteLn>c:\~dialogbmptest~.scp,wr,Dialog>Dialog%k%
WriteLn>c:\~dialogbmptest~.scp,wr,   Caption=View BMP number %k%
WriteLn>c:\~dialogbmptest~.scp,wr,   Width=347
WriteLn>c:\~dialogbmptest~.scp,wr,   Height=300
WriteLn>c:\~dialogbmptest~.scp,wr,   Top=180
WriteLn>c:\~dialogbmptest~.scp,wr,   Left=322
WriteLn>c:\~dialogbmptest~.scp,wr,   Button=OK,8,232,75,25,3
WriteLn>c:\~dialogbmptest~.scp,wr,   Button=Cancel,256,232,75,25,2
WriteLn>c:\~dialogbmptest~.scp,wr,   Edit=msEdit1,8,160,321,
WriteLn>c:\~dialogbmptest~.scp,wr,   Button= ,24,24,289,121,4,%BMPfile%
WriteLn>c:\~dialogbmptest~.scp,wr,   Button=Browse,8,192,75,25,4
WriteLn>c:\~dialogbmptest~.scp,wr,   FileBrowse=Browse,msEdit1,BMP files|*.bmp
WriteLn>c:\~dialogbmptest~.scp,wr,EndDialog>Dialog%k%
WriteLn>c:\~dialogbmptest~.scp,wr,Show>Dialog%k%,r%k%
WriteLn>c:\~dialogbmptest~.scp,wr,If>r%k%=2,finish
WriteLn>c:\~dialogbmptest~.scp,wr,If>r%k%=3
WriteLn>c:\~dialogbmptest~.scp,wr,  //dosomething
WriteLn>c:\~dialogbmptest~.scp,wr,Goto>continue
WriteLn>c:\~dialogbmptest~.scp,wr,Else
WriteLn>c:\~dialogbmptest~.scp,wr, Let>MACRO_RESULT=Dialog%k%.msEdit1
WriteLn>c:\~dialogbmptest~.scp,wr,Goto>continue
WriteLn>c:\~dialogbmptest~.scp,wr,EndIf
WriteLn>c:\~dialogbmptest~.scp,wr,Label>finish
WriteLn>c:\~dialogbmptest~.scp,wr,Let>MACRO_RESULT=finish
WriteLn>c:\~dialogbmptest~.scp,wr,Label>continue

Macro>c:\~dialogbmptest~.scp
DeleteFile>c:\~dialogbmptest~.scp
If>%MACRO_RESULT%=finish,quit
Let>BMPfile=%MACRO_RESULT%
Goto>start
Label>quit
Last edited by JRL on Thu Jun 22, 2006 8:49 pm, edited 1 time in total.

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Thu Jun 22, 2006 8:17 pm

Thanks Dick,

I've used this type of technique before, but never with a dialog. If I can wrap my mind around just how I can make this work within my app, I'll certainly give it a shot.

Paul

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