Stackable Panel Delphi Component
does anyone know of a Delphi component that implements something similar to what jquery sortable开发者_如何学Python does, but for a desktop application?
i.e. a vertical control that contains a number of panels that can be reordered and also used as containers for other components (specifically TMemos containing different bits of text).
Thanks for any info,
Breandan.
While I do it from code, and not designtime, this is what I would use a TScrollbox or TPanel containing some Frames or Panels, which are all aligned top, for. If I want a collapse/expand for the frames, I just put a button in the frame that allows you to collapse the frame to a minimal height such as 20 pixels when collapsed, and something taller when expanded.
the frames inside could really be any control you want, even Panels containing a few other controls. The top level controls can be reordered within the parent panel or scrollbox.
TMS Has TAdvPanelGroup that can be collapsed/expanded. See screenshot in the lower-right: http://www.tmssoftware.com/site/advpanel.asp
Only one run, then I move and resize them from the running application.
Here's the dfm:
object Form2: TForm2
Left = 0
Top = 0
Caption = 'Form2'
ClientHeight = 337
ClientWidth = 635
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object clbr1: TCoolBar
Left = 0
Top = 0
Width = 635
Height = 313
Bands = <
item
Control = gb1
ImageIndex = -1
MinHeight = 123
Width = 629
end
item
Control = pnl1
ImageIndex = -1
MinHeight = 112
Width = 629
end>
object gb1: TGroupBox
Left = 11
Top = 0
Width = 620
Height = 123
Caption = 'gb1'
TabOrder = 0
object lbledt1: TLabeledEdit
Left = 112
Top = 40
Width = 121
Height = 21
EditLabel.Width = 32
EditLabel.Height = 13
EditLabel.Caption = 'lbledt1'
TabOrder = 0
end
end
object pnl1: TPanel
Left = 11
Top = 125
Width = 620
Height = 112
Caption = 'pnl1'
TabOrder = 1
object rg1: TRadioGroup
Left = 128
Top = 4
Width = 185
Height = 105
Caption = 'rg1'
Items.Strings = (
'dsfsdf'
'sdfsdfsd')
TabOrder = 0
end
end
end
end
I haven't found a standard control that does what you want in Delphi 2007, but I would offer a custom solution similar to the one Warren suggested. The main difference is that I would create it within a TFrame so you could more easily maintain the code that allows you to manipulate the controls and their interaction with each other. You could also create methods within the frame for adding new panels (with memos and the text to display), move them around, etc.
It's a bit of work but it can also be a great learning experience. The best part is once you are done you can reuse that frame anywhere you want on any form or within another frame. If you do it right it will work without hassle as well.
精彩评论