Solved

Drag and Drop between ToolButtons in a ToolBar

Posted on 2004-09-24
5
264 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi XE2 application frozen on Windows 10 10 310
How to fill array with TArray.Create? 14 87
Intraweb download file link ? 1 132
Delphi and Access based Enumeration 9 59
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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

786 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