Solved

Delphi 7 :: TListView on ItemSelect mouse drag cursor

Posted on 2006-11-04
5
897 Views
Last Modified: 2012-08-14
Dear Friends,

I have a TListView which have several items in.
OnSelectItem event I make calls to a procedure which in return calls 2 other procedures
to run the relevant process for the selected item.

The TListView.DragMode = dmAutomatic.
I do call Application.ProcessMessages where any loops etc occur.
The problem is when selecting an Item and the process are a bit lengthy (not much) then when
releasing the mouse (normal single click) the cursor turns to the drag&drop cursor. Although I did not press and hold the mouse.

When I press and hold the mouse button down for while and then releasing then the problem
do not occur.


Any suggestion on how to solve this?

Thanks!
0
Comment
Question by:Marius0188
[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 15

Assisted Solution

by:mikelittlewood
mikelittlewood earned 50 total points
ID: 17876440
Have you tried just putting a processmessages first in the OnSelectItem to see if it will clear it.
0
 

Author Comment

by:Marius0188
ID: 17876620
Yes I have done that as well.

And all the calling Procedures as well.


Why does  Delphi's components sometimes seem to be so difficult for a simple
instruction like this? :) (Just feel like mowning today).

0
 
LVL 28

Accepted Solution

by:
TName earned 100 total points
ID: 17878203
Just a workaround, but you could try to move the code into the MouseUp event. Something like this:

procedure TForm1.ListView1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
   if ListView1.Selected<>nil then
     if ListView1.GetItemAt(X,Y)=ListView1.Selected then begin

      //Do stuff with ListView1.Selected

     end;
end;
0
 

Author Comment

by:Marius0188
ID: 17886537
Is there not a way I can fix the problem rather?
Dont wish to move my code to OnMouseUp as first option.

Any other suggestion?
0
 
LVL 2

Assisted Solution

by:WallaceAdrian
WallaceAdrian earned 100 total points
ID: 17912977
You could try changing the drag mode youreslf after your procedure has finished executing

eg

procedure TForm1.ListView1SelectItem(Sender: TObject; Item: TListItem;
  Selected: Boolean);
begin
  ListView1.DragMode := dmManual;
  callsleep;  // your ptocedure here
  ListView1.DragMode := dmAutomatic;
end;
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

690 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