Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GIFs and Refresh() problem
Message
De
24/04/2004 10:27:14
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00897827
Message ID:
00897897
Vues:
13
>Hi,
>
>Just by chance we found out a problem when using GIFs, we do not know if it is a well known problem or not (a quick search in UT gave negative results). The problem is that thisform.refresh will make a GIF displayed on an image control visible, disregarding the actual value of the 'visible' property of it, even if you put the image control in a container and hide the container.
>
>For example, this will show 3 images, the first one with just the image control, the second one we overlap the image with a shape (this works as a workaround in this case) and the third one is an image control inside a container that we make invisible:
>
>
>oForm = Createobject('Form1')
>oForm.Show(1)
>return
>
>oForm = Createobject('Form1')
>oForm.Show(1)
>return
>
>DEFINE CLASS form1 AS form
>
>
>	Top = 57
>	Left = 130
>	Height = 116
>	Width = 355
>	DoCreate = .T.
>	BorderStyle = 3
>	Caption = "Form1"
>	WindowState = 0
>	Name = "Form1"
>
>
>	ADD OBJECT shpgif2 AS shape WITH ;
>		Top = -2, ;
>		Left = 90, ;
>		Height = 97, ;
>		Width = 88, ;
>		BorderStyle = 0, ;
>		Visible = .F., ;
>		Name = "shpGif2"
>
>
>	ADD OBJECT cmdexit AS commandbutton WITH ;
>		Top = 82, ;
>		Left = 295, ;
>		Height = 32, ;
>		Width = 60, ;
>		Caption = "Exit", ;
>		TabIndex = 5, ;
>		Name = "cmdExit"
>
>
>	ADD OBJECT imggif1 AS image WITH ;
>		Picture = Home(4) + "gifs\morphfox.gif", ;
>		Stretch = 1, ;
>		Height = 97, ;
>		Left = 2, ;
>		Top = -2, ;
>		Width = 88, ;
>		Name = "imgGif1"
>
>
>	ADD OBJECT cmdhideshow AS commandbutton WITH ;
>		Top = 0, ;
>		Left = 295, ;
>		Height = 32, ;
>		Width = 60, ;
>		Caption = "Hide", ;
>		Name = "cmdHideShow"
>
>
>	ADD OBJECT cmdrefresh AS commandbutton WITH ;
>		Top = 41, ;
>		Left = 295, ;
>		Height = 32, ;
>		Width = 60, ;
>		Caption = "Refresh", ;
>		Name = "cmdRefresh"
>
>
>	ADD OBJECT chkvisiblegif AS checkbox WITH ;
>		Top = 95, ;
>		Left = 2, ;
>		Height = 17, ;
>		Width = 93, ;
>		Caption = "Visible Gif?", ;
>		ControlSource = "thisform.imggif1.visible", ;
>		ReadOnly = .T., ;
>		Name = "chkVisibleGif"
>
>
>	ADD OBJECT imggif2 AS image WITH ;
>		Picture = Home(4) + "gifs\morphfox.gif", ;
>		Stretch = 1, ;
>		Height = 97, ;
>		Left = 90, ;
>		Top = -2, ;
>		Width = 88, ;
>		Name = "imgGif2"
>
>
>	ADD OBJECT chkvisibleshp AS checkbox WITH ;
>		Top = 95, ;
>		Left = 92, ;
>		Height = 17, ;
>		Width = 114, ;
>		Caption = "Visible Shp?", ;
>		ControlSource = "thisform.shpGif2.visible", ;
>		ReadOnly = .T., ;
>		Name = "chkVisibleShp"
>
>
>	ADD OBJECT ctrgif3 AS container WITH ;
>		Top = -2, ;
>		Left = 178, ;
>		Width = 88, ;
>		Height = 97, ;
>		BorderWidth = 0, ;
>		Name = "ctrGif3"
>
>
>*!*		ADD OBJECT form1.ctrgif3.imggif3 AS image WITH ;
>*!*			Picture = Home(4) + "gifs\morphfox.gif", ;
>*!*			Stretch = 1, ;
>*!*			Height = 97, ;
>*!*			Left = 0, ;
>*!*			Top = 0, ;
>*!*			Width = 88, ;
>*!*			Name = "imgGif3"
>
>
>	ADD OBJECT chkvisiblectr AS checkbox WITH ;
>		Top = 96, ;
>		Left = 179, ;
>		Height = 17, ;
>		Width = 81, ;
>		Caption = "Visible Ctr?", ;
>		ControlSource = "thisform.ctrGif3.visible", ;
>		ReadOnly = .T., ;
>		Name = "chkVisibleCtr"
>
>
>	PROCEDURE cmdexit.Click
>		thisform.Release()
>	ENDPROC
>
>
>	PROCEDURE cmdhideshow.Click
>		if this.Caption = 'Hide'
>			this.Caption = 'Show'
>			thisform.imgGif1.Visible = .f.
>			thisform.shpGif2.Visible = .t.
>			thisform.ctrGif3.Visible = .f.
>		else
>			this.Caption = 'Hide'
>			thisform.imgGif1.Visible = .t.
>			thisform.shpGif2.Visible = .f.
>			thisform.ctrGif3.Visible = .t.
>		endif
>		thisform.chkVisibleGif.Refresh()
>		thisform.chkVisibleShp.Refresh()
>		thisform.chkVisibleCtr.Refresh()
>	ENDPROC
>
>
>	PROCEDURE cmdrefresh.Click
>		thisform.Refresh
>	ENDPROC
>
>	procedure init
>	
>		thisform.ctrGif3.addobject('imgGif3', 'Image')
>		with thisform.ctrGif3.imgGif3
>			.Picture = Home(4) + "gifs\morphfox.gif"
>			.Stretch = 1
>			.Height = 97
>			.Left = 0
>			.Top = 0
>			.Width = 88
>			.Visible = .t.
>		endwith
>		thisform.shpGif2.zorder(0)
>	endproc
>	
>ENDDEFINE
>
>
>Now after running this program if you click hide, all images are hidden, but as soon as you click the refresh button, which calls thisform.refresh(), the images 1 and 3 are shown again, although their visible property remains false, as shown in the checkboxes
>
>By the way, I do not know why the code generated by class browser does not work, I needed to change the code that is commented out and put it in the init as a quick workaround

Hugo,
Version ? It doesn't occur in VFP6 SP5, VFP7 SP1, VFP8 SP1.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform