Solved

Delphi 7 :: TListView on ItemSelect mouse drag cursor

Posted on 2006-11-04
5
893 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
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 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