Changing an image in a Dialog?
Moderators: JRL, Dorian (MJT support)
Changing an image in a Dialog?
Is it possible to change an image from one to another image in a Dialog? If so does anyone have a very simple example of this?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
For a v12 dialog just use SetDialogProperty.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
The trick is figuring out which property to set. I found this by trial and error with the emphasis on error.
We're all in this together. Hope this is helpful.
A little bit more elaborate sample, this one actually changes the image.
We're all in this together. Hope this is helpful.
Code: Select all
ScreenCapture>0,0,200,200,%temp_dir%dialogsample.bmp
Dialog>Dialog1
object Dialog1: TForm
Left = 10
Top = 0
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'CustomDialog'
ClientHeight = 223
ClientWidth = 439
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object MSImage1: tMSImage
Left = 0
Top = 0
Width = 200
Height = 200
LoadImage = ''
end
end
EndDialog>Dialog1
SetDialogProperty>Dialog1,MSImage1,LoadImage,%temp_dir%dialogsample.bmp
Show>Dialog1,res1
DeleteFile>%temp_dir%dialogsample.bmp
A little bit more elaborate sample, this one actually changes the image.
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
Left = 400
Top = 400
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'CustomDialog'
ClientHeight = 223
ClientWidth = 439
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object MSImage1: tMSImage
Left = 0
Top = 0
Width = 200
Height = 200
end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,,OnClose,DoClose
SRT>DoClose
DeleteFile>%temp_dir%dialogsample.bmp
Exit>0
END>DoClose
Show>Dialog1
Let>xx=0
Let>yy=0
Label>Loop
Add>xx,1
Let>tlx=xx
Let>tly=yy
Let>lrx=%xx%+200
Let>lry=%yy%+200
ScreenCapture>tlx,tly,lrx,lry,%temp_dir%dialogsample.bmp
SetDialogProperty>Dialog1,MSImage1,LoadImage,%temp_dir%dialogsample.bmp
Wait>0.01
If>xx>1000
GoSub>DoClose
EndIf
Goto>Loop
Thanks JRL, great example!
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 -
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 -
