Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BUG: Anchor a Autosize object
Message
De
14/06/2004 13:07:30
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Titre:
BUG: Anchor a Autosize object
Divers
Thread ID:
00913546
Message ID:
00913546
Vues:
52
Reported to the VFPT.

This is a Visual FoxPro: bug

FoxPro Version: 9.1720

Reproduces: always

Subject

When in a Control Autosize = .T. and Control.Anchor # 0 the Control.Move is called two times.

Steps to Reproduce

- Run this program

- press GO

* Autosize is F

- Changes as you want one of the four chosen in order to simulate the process

- set the yellow checkBox Autosize to T

- the Program trap the bad sequence and stop the simulation process

- read the output, e observe with attention the previous sequence

- if you want retry and stop the process, press Stop
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form

	AutoCenter = .T.
	Caption = "Click on GO for start, the change Option"
	AllowOutput = .F.
	Name = "Form1"

	ADD OBJECT check1 AS checkbox WITH ;
		Top = 124, ;
		Left = 4, ;
		Height = 50, ;
		Width = 400, ;
		Anchor = (0x0F), ;
		Caption = "Autosize", ;
		ControlSource = "this.Autosize", ;
		BackColor = RGB(255,255,0), ;
		Name = "Check1"

	ADD OBJECT optiongroup1 AS optiongroup WITH ;
		ButtonCount = 4, ;
		Value = 1, ;
		Height = 94, ;
		Left = 8, ;
		Top = 6, ;
		Width = 202, ;
		Name = "Optiongroup1", ;
		Option1.Caption = "H DOEVENTS", ;
		Option1.Value = 1, ;
		Option1.Height = 17, ;
		Option1.Left = 92, ;
		Option1.Top = 10, ;
		Option1.Width = 95, ;
		Option1.AutoSize = .T., ;
		Option1.Name = "Option1", ;
		Option2.Alignment = 1, ;
		Option2.Caption = "W DOEV", ;
		Option2.Height = 17, ;
		Option2.Left = 8, ;
		Option2.Top = 36, ;
		Option2.Width = 65, ;
		Option2.AutoSize = .T., ;
		Option2.Name = "Option2", ;
		Option3.Caption = "W FORCE", ;
		Option3.Height = 17, ;
		Option3.Left = 128, ;
		Option3.Top = 36, ;
		Option3.Width = 74, ;
		Option3.AutoSize = .T., ;
		Option3.Name = "Option3", ;
		Option4.Alignment = 9, ;
		Option4.Caption = "H FORCE", ;
		Option4.Height = 17, ;
		Option4.Left = 91, ;
		Option4.Top = 64, ;
		Option4.Width = 72, ;
		Option4.AutoSize = .T., ;
		Option4.Name = "Option4"

	ADD OBJECT go AS checkbox WITH ;
		Top = 38, ;
		Left = 91, ;
		Height = 27, ;
		Width = 36, ;
		AutoSize = .T., ;
		Alignment = 2, ;
		Caption = "GO", ;
		Value = .F., ;
		Style = 1, ;
		BackColor = RGB(255,0,0), ;
		Name = "GO"

	PROCEDURE Paint
		thisFORM.Tag = ''
		? "PAINT FORM"
	ENDPROC

	PROCEDURE Resize
		thisform.Tag="Resize Done"
		? "RESIZE	"
		WITH THIS.check1
			IF .Autosize
				?? "Control LTWH values ARE	",.left at 40,.top,.width,.height
			ENDIF
		ENDWITH
	ENDPROC

	PROCEDURE Load
		CLEAR
	ENDPROC

	PROCEDURE QueryUnload
		IF THISFORM.GO.Value
			NODEFAULT
		ENDIF
	ENDPROC

	PROCEDURE Check1.Move
		LPARAMETERS nLeft, nTop, nWidth, nHeight
		? "ANCHOR MOVE THE CONTROL"
		? "current Control setting is",this.left at 40,this.top,this.width,this.height
		? "Anchor Move the Control to", m.nLeft at 40, m.nTop, m.nWidth, m.nHeight

		IF thisform.Tag=="Resize Done"
			thisform.GO.Value = .F.
			? "I expected that this event not occur"
			? "This is a Anchor call after Parent.Resize event "
			? "It is useless and only a source of complication"
		ELSE
		*	? "This is the correct call"
		ENDIF
		thisform.Tag = ''
	ENDPROC

	PROCEDURE Optiongroup1.Click
		DO WHILE thisform.activeControl#thisform.GO
			thisform.GO.SetFocus
		ENDDO
	ENDPROC

	PROCEDURE GO.Click
		this.Caption = "Stop"
		LOCAL nSize
		nSize=0
		DO WHILE m.this.value
			thisForm.Tag = ''
			nSize = 300+101*((m.nsize+1)%2)
			DO CASE 
				CASE thisform.Optiongroup1.Value = 1 && H ASYNC
						thisform.Height = m.nSize
						DOEVENTS
				CASE thisform.Optiongroup1.Value = 2
						thisform.Width = m.nSize
						DOEVENTS
				CASE thisform.Optiongroup1.Value = 3
						thisform.Width = m.nSize
						DOEVENTS FORCE
				CASE thisform.Optiongroup1.Value = 4
						thisform.Height = m.nSize
						DOEVENTS FORCE 
			ENDCASE
		ENDDO
		this.Caption = "GO"
	ENDPROC

	PROCEDURE check1.InteractiveChange
		? '>>>>>>>>>>> Autosize',this.Value
	ENDPROC
ENDDEFINE
Observed Behavior
When ControlAutoSize = .F. it call Control.Move() one time, before Parent.Resize() event

When ControlAutoSize = .T. it call Control.Move() two times,

before Parent.Resize() event and after the Parent.Resize() event

Expecteded Behavior
The Anchor process and the called event/methods is indipendent by the AutoSize setting,

and then

The Anchor process have not to call the Control.Move() method after the Parent.Resize() event


Fabio
Répondre
Fil
Voir

Click here to load this message in the networking platform