Solved

TControlBar problem

Posted on 2001-07-14
7
344 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
code issue 8 183
Making delphi communicate with a c# service 16 122
Base1 Encode/Decode 3 86
Embarcadero C++ builder XE10.1 Berlin find In files dialogue stunted display 4 73
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…

740 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