?
Solved

Drag and Drop between ToolButtons in a ToolBar

Posted on 2004-09-24
5
Medium Priority
?
300 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 23

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 800 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

864 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