Solved

TControlBar problem

Posted on 2001-07-14
7
335 Views
Last Modified: 2010-04-04
TControlBar problem

When I press some Bar of ControlBar1 for moving, how to know what component is in that bar ?
0
Comment
Question by:cvbmn
7 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 6282205
Use the TControlBar.OnBandMove event. It has a parameter 'Control' which it the control being moved.
0
 

Author Comment

by:cvbmn
ID: 6282282
// This is code. I am not satisfied with it.
// When I press one of bars, Form1 doesn't show automaticly controls name.
// Thanks.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls;

type
  TForm1 = class(TForm)
    ControlBar1: TControlBar;
    Panel1: TPanel;
    Panel2: TPanel;
    procedure ControlBar1BandMove(Sender: TObject; Control: TControl;
      var ARect: TRect);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}


procedure TForm1.ControlBar1BandMove(Sender: TObject; Control: TControl;
  var ARect: TRect);
begin
if control = Panel1 then form1.Caption:=panel1.name;
if control = Panel2 then form1.Caption:=panel2.name;
end;

end.
0
 

Expert Comment

by:felonious
ID: 6282301
You may for some reason need to force your form1.caption to update.  try

Form1.Repaint

ofcourse there may be some other problem also :)  I will try your code out and see what happens

-felonious
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:felonious
ID: 6282332
hmmm, i tried the above code and its definately not a repaint problem.  it seems that when you move one control on the ControlBar then other is also moved (even if it doesn't seem to change position).  At the moment I cant think of an easy way around this.

-felonious
0
 

Author Comment

by:cvbmn
ID: 6283016
Can you show me some code. I'll increase points to 200.
0
 

Author Comment

by:cvbmn
ID: 6283062
And also, how to disable band moving ?
0
 
LVL 2

Accepted Solution

by:
vbmn earned 200 total points
ID: 6283978
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    ControlBar1: TControlBar;
    procedure ControlBar1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.ControlBar1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
end;

end.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now