?
Solved

A general MouseDown Event

Posted on 1998-11-02
8
Medium Priority
?
833 Views
Last Modified: 2010-04-06
In a program I'm working on I fugered out a way to make a personal Drage and Drop from scratch. I know that delphi handles D&D but I need more control. The program needs the pointer to pull around a form. but still offsetted from the pointers current postion by 10 X and Y. once that the mousedown event in the component that the user selects from is used and the pointer is draged around the component the form follows but as soon as the pointer leaves the area of the component the form stops. I could make all MouseDown event of the components point to the same code lines but I need it to cross over to another form. Ex. from Form1 to Form2. is there a way that a single MouseDown Event can handle this with out pointing all the other MouseDown events to the one Event?

willing to give points, so examples will be needed...

Thanks
PPaul
0
Comment
Question by:PPaul
[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
8 Comments
 
LVL 4

Expert Comment

by:dwwang
ID: 1345499
Do you mean you what to share an event among all the forms?
0
 

Author Comment

by:PPaul
ID: 1345500
yes I guest... I need the one Procedure to handle forms, the screen, other components.  Just like the Drag & Drop handled by delhpi The pointer dosen't stop when it goes out the the starting component. The reason I need this it so that I can read what is under the pointer and still drage the form...

Example: 3 forms. 2 are shown all the time whill the program is runnung. when the user clicks on an Item in a listbox on form 1 and starts to drage it form 3 is poped up with a copy of the text and/or Icon in it. as the pointer is being drag accross from form 1 to form 2 it has to cross the desktop. The pointer still needs to drage form3 with it accross. Onec in the form 2 area form3 is still showing with the pointer.

I could get every Object MouseDown Event point to the same code but I was wondering if there is a way that this could be cut down to one event that is called with out any of the other objects MouseDown events being used....

0
 
LVL 4

Expert Comment

by:dwwang
ID: 1345501
But I wonder why you think about mousedown? isn't what you want should be done in OnDragOver?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:PPaul
ID: 1345502
eather way... (I tested it...) I would need to make all the components point to the same code.... I would like a way that would do that in one code without pointing all components to the one spot.  
0
 
LVL 4

Expert Comment

by:dwwang
ID: 1345503
Well, on method I think is to capture the CM_Drag Message, but it is rather complex, I don't know whether it is valuable.
0
 
LVL 3

Expert Comment

by:williams2
ID: 1345504
Forget it.. it's not done this way! ..You should read about Message API handling routines instead.
1. You cannot share code directly between forms, because systems like windows NT runs applications in different memory environments.. (DDE could be a solution?)
2. You will have write specific OLE controls overriding the standard form methods, using drag'n'drop capabilities.. (search for dndfiles.zip on share-ware sites to see an example of Drag'n'drop from and to a form application)

Drag'n'drop is far more complex than a WM_MOUSE_DOWN event...
0
 

Author Comment

by:PPaul
ID: 1345505
Ok then, is there a way in the drag and drop of delphi. to use the X,Y of the mouse during D&D. So that I can make a image move with the pointer????
0
 

Accepted Solution

by:
endro earned 400 total points
ID: 1345506
This is one of the solutions (if this is what you meant).

Create a new procedure to handle the event

procedure handle_it(x,y : integer; ... other params);
begin
  .
  .
end;

Suppose you put this procedure to different unit (let's call it unit unHandle), call the unit in both forms, and on OnMouseDown event you can call the procedure.

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

752 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