Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resiable Panels on the form 2

Status
Not open for further replies.

nirajj

Programmer
Mar 12, 2003
103
US
I was wondering if anybody had idea about how to create different panels on the form that are reziable, but when you resize the panel the other panels would resize too.

I dont know if i am clear enuf.
Basically lets take example of help files. Just like help has left and right panel and you can adjust the width by the central seperator. I was wondering if something of that sort could be done.

Any idea will be good. However, I am looking to add new controls over the panels. So just to make sure it shouldnt be listbox.

Thanks !
 
Yes it can be done. Try this:

oForm = CreateObject('Form1')
oForm.Show(1)

oForm = Null
Release oForm
Clear all

Define class Form1 as Form
DoCreate = .T.
Caption = 'Form1'
Name = 'Form1'
Width = 375
Height = 250
nLeft = 0
nWidth = 0

Add object Con1 as Container with ;
Left = 3, Top = 10, Width = 144, Height = 231, ;
BackColor = RGB(255,255,255), SpecialEffect = 1, ;
Name = 'Con1'

Add object Con2 as Container with ;
Left = 153, Top = 10, Width = 219, Height = 231, ;
BackColor = RGB(255,255,255), SpecialEffect = 1, ;
Name = 'Con2'

Add object Shape1 as Shape with ;
Left = 146, Top = 10, Width = 7, Height = 231, ;
SpecialEffect = 0, Visible = .F., ;
Name = 'Shape1'

Add object Shape2 as Shape with ;
Left = 146, Top = 10, Width = 7, Height = 231, ;
SpecialEffect = 0, Name = 'Shape2'

Procedure Shape2.MouseDown
LParameters nButton, nShift, nXCoord, nYCoord
If (nButton == 1)
With ThisForm
.nLeft = nXCoord
.nWidth = 0
.Shape1.Visible = .T.
EndWith
endif
EndProc

Procedure Shape2.MouseMove
LParameters nButton, nShift, nXCoord, nYCoord
Local ln_Width
If (nButton == 1) && 1-left button, 2-right button
With ThisForm
ln_Width = nXCoord - .nLeft
.Shape1.Left = .Shape1.Left + ln_Width
.nWidth = .nWidth + ln_Width
.nLeft = nXCoord
EndWith
endif
EndProc

Procedure Shape2.MouseUp
LParameters nButton, nShift, nXCoord, nYCoord
If (nButton = 1)
With ThisForm
This.Left = .Shape1.Left
.Con1.Width = .Con1.Width + .nWidth
.Con2.Left = .Con2.Left + .nWidth
.Con2.Width = .Con2.Width - .nWidth
.Shape1.Visible = .F.
EndWith
endif
EndProc
EndDefine


-- AirCon --
 
Nice one Aircon!

Darrell


'We all must do the hard bits so when we get bit we know where to bite' :)
 
Thanks AirCon ,

Just what I was looking for. This is wonderful.
Thank you. Take another star.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top