Recent

Author Topic: TPanel and it's bevel... / Dynamic Splitter  (Read 9338 times)

Adam.Pilorz

  • Jr. Member
  • **
  • Posts: 67
    • http://www.pilotmp3.devtown.net
TPanel and it's bevel... / Dynamic Splitter
« on: December 09, 2004, 06:27:04 pm »
Hello. I've tried to dynamicaly create a Panel, but unfortunately line like this:
  Panel2.BevelInner:=bvNone;
ends with "Undeclared identifier: bvNone" error. I have unit Controls in my uses clause, and creating Panel works, but I can't set it's Bevel property. In Delphi such thing works. Why is that so?

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
TPanel and it's bevel... / Dynamic Splitter
« Reply #1 on: December 10, 2004, 11:40:08 am »
pfff... took me some time to firuge it out.
BevelInner is a TPanelBevelCut
TPanelBevelCut = TBevelCut (defined in ExtCtrls)
TBevelCut = TGraphicsBevelCut (defined in controls)
TGraphicsBevelCut is defined in GraphType and there also bvNone is defined.

So add uses GraphType.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Adam.Pilorz

  • Jr. Member
  • **
  • Posts: 67
    • http://www.pilotmp3.devtown.net
TPanel and it's bevel... / Dynamic Splitter
« Reply #2 on: December 10, 2004, 01:46:40 pm »
Hmm... Looks interesting :] Thanks for advice. And I have another question, maybe not exactly linked with the problem, but a bit... I'm creating TPanel, then I'm setting it as TreeView's parent. Then I'm setting it's align property to AlLeft. After that I'm creating a TSplitter on that panel, and too setting it's align as alLeft. After doing that, I'm craeting second panel on this first, and setting it's Align property to alClient. And it should look like that: On the left of the panel is TTreeView, next to it (on it's right side) a splitter and on the right of the splitter another panel. Unfortunately it doesn't look like it. The splitter is on the beggining on left side of the main panel, and after it a TreeView. What's wrong?
Code: [Select]
 Panel1:=TPanel.Create(ReceiveForm);
  Panel1.Parent:=ReceiveForm;
  Panel1.BevelInner:=bvNone;
  Panel1.BevelOuter:=bvNone;

  TreeView1.Parent:=Panel1;
  TreeView1.Align:=alLeft;
 
  Splitter1:=TSplitter.Create(Panel1);
  Splitter1.Parent:=Panel1;
  Splitter1.Align:=alLeft;
  Splitter1.Width:=2;
 
  Panel2:=TPanel.Create(Panel1);
  Panel2.Parent:=Panel1;
  Panel2.Align:=alClient;
  Panel2.BevelInner:=bvNone;
  Panel2.BevelOuter:=bvNone;

Adam.Pilorz

  • Jr. Member
  • **
  • Posts: 67
    • http://www.pilotmp3.devtown.net
TPanel and it's bevel... / Dynamic Splitter
« Reply #3 on: December 10, 2004, 02:30:15 pm »
Well, I've tried several things and I've menaged to do it. But it needed creation of all components dynamicaly to work. Here's the smaple:
Code: [Select]
 Panel1:=TPanel.Create(ReceiveForm);
  Panel1.Parent:=ReceiveForm;
  Panel1.BevelInner:=bvNone;
  Panel1.BevelOuter:=bvNone;

  Splitter1:=TSplitter.Create(Panel1);
  TreeView1:=TTreeView.Create(Panel1);
  TreeView1.Parent:=Panel1;
  Splitter1.Parent:=Panel1;
  TreeView1.Align:=alLeft;
  Splitter1.Align:=alLeft;
  Splitter1.Width:=1;

  Panel2:=TPanel.Create(Panel1);
  Panel2.Parent:=Panel1;
  Panel2.Align:=alClient;
  Panel2.BevelInner:=bvNone;
  Panel2.BevelOuter:=bvNone;

But there still is a question how to do it, when one of components isn't dynamicaly created...

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
TPanel and it's bevel... / Dynamic Splitter
« Reply #4 on: December 10, 2004, 04:46:45 pm »
I tried creating it in the designer and it worked. Why did you follow a mixed (designer/code) strategy in your first example?

Adam.Pilorz

  • Jr. Member
  • **
  • Posts: 67
    • http://www.pilotmp3.devtown.net
TPanel and it's bevel... / Dynamic Splitter
« Reply #5 on: December 10, 2004, 05:45:56 pm »
Well, the problem is, I've created part of my application in designer mode, but then I wanted to change it to be more dynamic. But right now it isn't such a problem, because I'm transferring all into dynamic style, but I think it would be useful for others.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
TPanel and it's bevel... / Dynamic Splitter
« Reply #6 on: December 13, 2004, 01:47:30 pm »
This is known with alignment. The moment you create the splitter, its Left property is 0. So changing the align to alLeft would place it before the TreeView. When you set Splitter.Left := Treeview.Width once, it get aligned right.
When designing,  simply grab the splitter and pull it to the right.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

 

TinyPortal © 2005-2018