As said in the subject...

When I have a listbox and/or TDirectoryListBox onscreen, populated with
only  a few items, ItemAtPos seems to be working fine. Initially.

However, once the DirListBox has been updated a few times, or once the
CustomListBox has been scrolled, things go seriously screwy. In the Listbox,
once it's so full that I get a scrollbar, most positions I click the mouse return a 
-1 for ItemAtPos ( even when it's not past the end of the list ). Even when I
delete a number of items and the list is no longer scrolled, the erratic 
behaviour continues: false values are given for ItemIndex, and/or -1 is 
returned.

My first attempt at a workaround was to simply write my own handler for
OnMouseDown and do
ListBox.ItemIndex := Listbox.ItemHeight div MouseY;
but this no longer works correctly once the list is scrolled.

If anybody could give me a useful pointer here .....

What it's all about: I am trying to define a shortcut action - so if I right-click in
the DirList the item under the mouse gets copied into another list ( instead of
selected or opened ) but unfortunately the right-click does not select the item
in the first place so I need to select it manually by doing a left-click first or 
programmatically which would be the solution of choice. 
Vice versa, I want to delete the item under the cursor in the second list 
window, when right clicked ... again I need the ItemIndex to be able to do so.

TIA,   -Peter
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to