Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can not get the logic right
Message
De
23/06/2009 09:49:21
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01407699
Message ID:
01407775
Vues:
65
This message has been marked as a message which has helped to the initial question of the thread.
Naomi / Tracy (your new nickname?) --

If the anchor property is not zero when you move a control, then you will lose the effect of moving the control the next time that anchor properties would have any effect.

Thus, if you are moving controls yourself, you need to (as Agnes pointed out):

(1) Save the anchor property
(2) Set it to zero.
(3) Move it / resize it as needed
(4) Restore the anchor property.

This is, by the way, exactly what the 'ChangeFontSize' class does, a class which I created directly in response to this discussion.

Jim



>I hoped it would be easy for people here to spot the problem in what I'm doing.
>
>Anyone, please?
>
>
>>Here is the whole control I've been working on:
>>
>>
>>**************************************************
>>*-- Class:        cntmover (w:\sss\smna\proctrls.vcx)
>>*-- ParentClass:  container
>>*-- BaseClass:    container
>>*-- Time Stamp:   06/22/09 05:33:11 PM
>>*-- Mover class
>>*
>>DEFINE CLASS cntmover AS container
>>
>>
>>	Width = 516
>>	Height = 221
>>	BackStyle = 0
>>	BorderWidth = 0
>>	Name = "cntmover"
>>
>>	*-- Array list of items
>>	DIMENSION arritems[1]
>>
>>
>>	ADD OBJECT cmdmoveone AS commandbutton_ WITH ;
>>		Top = 44, ;
>>		Left = 242, ;
>>		Height = 26, ;
>>		Width = 30, ;
>>		Anchor = 768, ;
>>		Picture = "..\..\vpme91\bitmaps\mover1.bmp", ;
>>		Caption = "", ;
>>		TabIndex = 4, ;
>>		ToolTipText = "Move", ;
>>		Name = "cmdMoveOne"
>>
>>
>>	ADD OBJECT cmdmoveall AS commandbutton_ WITH ;
>>		Top = 76, ;
>>		Left = 242, ;
>>		Height = 26, ;
>>		Width = 30, ;
>>		Anchor = 768, ;
>>		Picture = "..\..\vpme91\bitmaps\mover2.bmp", ;
>>		Caption = "", ;
>>		TabIndex = 5, ;
>>		ToolTipText = "Move All", ;
>>		Name = "cmdMoveAll"
>>
>>
>>	ADD OBJECT cmdremoveone AS commandbutton_ WITH ;
>>		Top = 118, ;
>>		Left = 242, ;
>>		Height = 26, ;
>>		Width = 30, ;
>>		Anchor = 768, ;
>>		Picture = "..\..\vpme91\bitmaps\mover_1.bmp", ;
>>		Caption = "", ;
>>		TabIndex = 6, ;
>>		ToolTipText = "Remove", ;
>>		Name = "cmdRemoveOne"
>>
>>
>>	ADD OBJECT cmdremoveall AS commandbutton_ WITH ;
>>		Top = 150, ;
>>		Left = 242, ;
>>		Height = 26, ;
>>		Width = 30, ;
>>		Anchor = 768, ;
>>		Picture = "..\..\vpme91\bitmaps\mover_2.bmp", ;
>>		Caption = "", ;
>>		TabIndex = 7, ;
>>		ToolTipText = "Remove All", ;
>>		Name = "cmdRemoveAll"
>>
>>
>>	ADD OBJECT lstsource AS listbox_ WITH ;
>>		OLEDragMode = 1, ;
>>		OLEDropMode = 1, ;
>>		FontName = "Arial", ;
>>		Anchor = 45, ;
>>		RowSourceType = 0, ;
>>		RowSource = "", ;
>>		Value = "", ;
>>		Height = 204, ;
>>		Left = 0, ;
>>		MultiSelect = .T., ;
>>		TabIndex = 3, ;
>>		Top = 17, ;
>>		Width = 228, ;
>>		Name = "lstSource"
>>
>>
>>	ADD OBJECT lblsource AS label_ WITH ;
>>		Caption = "Source", ;
>>		Left = 3, ;
>>		Top = 0, ;
>>		TabIndex = 2, ;
>>		Name = "lblSource"
>>
>>
>>	ADD OBJECT lbldestination AS label_ WITH ;
>>		Caption = "Destination", ;
>>		Height = 17, ;
>>		Left = 291, ;
>>		Top = 0, ;
>>		Width = 65, ;
>>		TabIndex = 8, ;
>>		Name = "lblDestination"
>>
>>
>>	ADD OBJECT lstdestination AS listbox_ WITH ;
>>		OLEDragMode = 1, ;
>>		OLEDropMode = 1, ;
>>		FontName = "Arial", ;
>>		Anchor = 45, ;
>>		RowSourceType = 0, ;
>>		RowSource = "", ;
>>		Value = "", ;
>>		Height = 204, ;
>>		Left = 288, ;
>>		MultiSelect = .T., ;
>>		TabIndex = 9, ;
>>		Top = 17, ;
>>		Width = 228, ;
>>		Name = "lstDestination"
>>
>>
>>	PROCEDURE Init
>>		** Would changing anchor settings be enough for auto-resize?
>>		DODEFAULT()
>>		LOCAL lnAdjust, lnButtonsHeight, lnNewTop, lnBetweenListsSpace, lnExtraWidth
>>		STORE (this.Height - this.lstDestination.Top - 2)  TO this.lstDestination.Height, this.lstSource.Height
>>		lnButtonsHeight = 132
>>		lnNewTop = (this.Height - m.lnButtonsHeight)/2
>>		lnAdjust =  m.lnNewTop - this.cmdMoveOne.Top
>>
>>		this.cmdMoveOne.Top = m.lnNewTop + m.lnAdjust  
>>		this.cmdMoveAll.Top = this.cmdMoveAll.Top + m.lnAdjust   
>>		this.cmdReMoveOne.Top = this.cmdReMoveOne.Top + m.lnAdjust  
>>		this.cmdReMoveAll.Top = this.cmdReMoveAll.Top + m.lnAdjust  
>>
>>		lnBetweenListsSpace = this.lstDestination.Left - this.lstSource.Width && assuming that lstSource.Left = 0  
>>		lnExtraWidth = (this.Width - (2*this.lstDestination.Width + m.lnBetweenListsSpace))/2
>>		STORE (this.lstDestination.Width + m.lnExtraWidth) TO this.lstSource.Width, this.lblDestination.Width 
>>		STORE (this.cmdMoveAll.Left + m.lnExtraWidth) TO this.cmdMoveAll.Left, this.cmdMoveOne.Left, ;
>>		 												 this.cmdReMoveAll.Left, this.cmdReMoveOne.Left
>>		this.lblDestination.Left = this.lblDestination.Left + m.lnExtraWidth
>>		this.lstDestination.Left = this.lstDestination.Left + m.lnExtraWidth 
>>
>>		   
>>	ENDPROC
>>
>>
>>ENDDEFINE
>>*
>>*-- EndDefine: cntmover
>>**************************************************
>>
Jim Nelson
Newbury Park, CA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform