Solved

TControlBar problem

Posted on 2001-07-14
7
334 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
Comment Utility
Use the TControlBar.OnBandMove event. It has a parameter 'Control' which it the control being moved.
0
 

Author Comment

by:cvbmn
Comment Utility
// 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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Expert Comment

by:felonious
Comment Utility
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
Comment Utility
Can you show me some code. I'll increase points to 200.
0
 

Author Comment

by:cvbmn
Comment Utility
And also, how to disable band moving ?
0
 
LVL 2

Accepted Solution

by:
vbmn earned 200 total points
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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