Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Design time re-size
Message
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01406083
Message ID:
01407875
Views:
55
>I don't believe you should be trying to use the native Anchoring for these controls. Like I said in the first post I don't think it can handle the complexity of the situation.
>
>>I assume you mean the container Anchor should be set to something - is 45 the correct setting?
>>
>>Or I'm missing something again?
>>
>>Using your idea - do I have to set Anchor settings appropriately for all controls (but in the initial re-position set them to 0 and only then to right values at the end)?

In this case you confused me again.

Do we want to set outer container's Anchor to 45 or not. Where exactly should we place our re-positioning code?

Right now I have in the Init of the cntMover class

Init:
DODEFAULT()
this.AddProperty('nOriginalHeight',this.Parent.Height)
this.AddProperty('nOriginalWidth',this.Parent.Width)
this.AdjustPositions("Init") 
this.lInitDone = .t.
AdjustPositions
LPARAMETERS tcCalledFrom
*=MESSAGEBOX(tcCalledFrom)
thisform.LockScreen = .T.
this.Anchor = 0

LOCAL lnAdjust, lnButtonsHeight, lnNewTop, lnBetweenListsSpace, lnExtraWidth, lnNewHeight

lnNewHeight = (this.Height - this.lstDestination.Top - 2)

STORE  m.lnNewHeight TO this.lstDestination.Height, this.lstSource.Height

lnButtonsHeight = (this.cmdRemoveAll.Top + this.cmdRemoveAll.Height) - this.cmdMoveOne.Top  
lnNewTop = this.lstDestination.Top + (m.lnNewHeight - m.lnButtonsHeight)/2
lnAdjust =  m.lnNewTop - this.cmdMoveOne.Top

this.cmdMoveOne.Top = m.lnNewTop
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 
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 

STORE 45 TO this.lstDestination.Anchor, this.lstSource.Anchor 
STORE 768 TO this.cmdMoveAll.Anchor, this.cmdMoveOne.Anchor, this.cmdRemoveAll.Anchor, this.cmdRemoveOne.Anchor 
this.lblDestination.Anchor = 8
this.Anchor = 45
thisform.LockScreen = .F.
And in the resize I have:
if this.lInitDone
   dodefault()
else
  nodefault
endif
The effect I observe is this - initially forms starts OK (the controls position itself). When I start changing size of the form, the listboxes grow wider, but the buttons could not keep up (the listboxes overlap the buttons).

Commenting out last 3 lines before this.Anchor = 45 also doesn't help. Finally, I can apply resizing in the form itself (I want to have some controls at the top, then two movers, then a grid), but then it would be too much work and I wanted the class itself to handle parent resizing properly.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform