Board index » delphi » mousemove event need help

mousemove event need help

Hello all
I create a mousemove event for a DirectoryListBox so that when mouse move
over a node at this listbox, depend on the what is that node, different actions
will be done. The problem here is that when the mouse still move over that
node (the same node but X, Y change), the actions replicate again and again
( flicking - because X, Y change).

node:=DirectoryListBox1.GetNodeAt(X,Y);
path:=DirectoryListBox1.GetPathFromNode(node);
..
if path=..... then
action
...

Could you please help me solve this problem.
Thank you for your help
Nhuyen

http://www.zfree.co.nz

 

Re:mousemove event need help


"Nhuyen" <sonphu...@zfree.co.nz> skrev i melding
news:3b656710$1@zfree.co.nz...

Quote

> Hello all
> I create a mousemove event for a DirectoryListBox so that when mouse move
> over a node at this listbox, depend on the what is that node, different
actions
> will be done. The problem here is that when the mouse still move over that
> node (the same node but X, Y change), the actions replicate again and again
> ( flicking - because X, Y change).

You should store the last index, so that a new action takes place only when
the selected one has changed. need to reset the FOldNode variable before
filling the listbox, so that you get a mouseover effect when the contents
changes.

node:=DirectoryListBox1.GetNodeAt(X,Y);
if node <> FOldNode then begin
  path:=DirectoryListBox1.GetPathFromNode(node);
  if path=..... then
  action
end;
FOldNode:=node;

To Reset:

  FOldNode:=-1;

--
Bjoerge Saether
Consultant / Developer
http://www.itte.no
Asker, Norway
bjorge@takethisaway_itte.no (remve the obvious)

Other Threads