Solved

Drag and Drop between ToolButtons in a ToolBar

Posted on 2004-09-24
5
260 Views
Last Modified: 2010-04-05
Hi,

Can somebody quickly provide me with some sample code to implement drag and drop between ToolButtons in a ToolBar. I am feeling lazy to find it out.

regards,
Partha
0
Comment
Question by:perthg
5 Comments
 
LVL 12

Expert Comment

by:esoftbg
ID: 12140776
What do you want to be dragged between these two buttons ? (May be you need to interchange the captions each other ?)
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 12140828
Or do you want just to drag them between themself? Waiting for input addition.

BTW Partha, i've found that you've a few questions still open, and in one of these i've provided a full working solution, but it seems that you've abandoned it.

What's going on? If you need more help in your questions just ask for it...


04/03/2004 http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20942169.html
06/27/2004 http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21039634.html
07/22/2004 http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21067382.html
08/18/2004 http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21098533.html
08/25/2004 http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21106231.html
08/25/2004 http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21106232.html

F68 ;-)
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12140852
you can drag them ... at design-time :)))
0
 

Author Comment

by:perthg
ID: 12141358
I want to drag and drop between ToolButtons to interchange their positions.

F68, the questions are open because I did'nt find an acceptable reply, however I am sorry that I missed the one you replied because I solved the problem myself. But you deserve the points, Thanks a lot.

Partha
0
 
LVL 12

Accepted Solution

by:
esoftbg earned 200 total points
ID: 12141732
download a working example from:
page:        http://www.geocities.com/esoftbg/
  link:        Q_21143474.zip

//........

procedure TForm1.ToolButton1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
begin
  if (Source is TToolButton) then
    Accept :=  ((Source as TToolButton)<>Sender);
end;

procedure TForm1.ToolButton1DragDrop(Sender, Source: TObject; X, Y: Integer);
var
  I:      Integer;
begin
  if (Sender is TToolButton) then
  begin
    I := (Sender as TToolButton).Left;
    if (Source is TToolButton) then
    begin
      (Sender as TToolButton).Left := (Source as TToolButton).Left + 1;
      (Source as TToolButton).Left := I + 1;
    end;
  end;
end;
0

Featured Post

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

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Upon Adding the FTP component my Apk not functioning 4 33
Printing problem 2 72
Delphi Form ownership 4 53
How to debug For loops? 3 34
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

706 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

19 Experts available now in Live!

Get 1:1 Help Now