Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Drag and Drop between ToolButtons in a ToolBar

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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

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…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

610 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