News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Yet another list view question.

Started by hutch--, April 04, 2011, 04:09:34 AM

Previous topic - Next topic

hutch--

I have the list view control up and going and it responds to mouse cliick in more or less conventional ways but I have had nothing but PHUN trying to get keyboard control working. You can navigate a report view list view control with arrow keys which changes the highlited item but it does not change the selection.

Processing the LVN_KEYDOWN notification message is straight forward enough but the LV_KEYDOWN structure does not contain the data for the selection so I have tried playing with LVM_GETHOTITEM and if the item was selected by the mouse it works correctly but if you scroll up or down with the arrow keys the current hot item does not update. I need to be able to use both the enter and delete keys to handle selection and deletion from the keyboard but I have not got iteliable yet.

I had a look at both Edgar's file manager and an old one that works OK but neither have keyboard support, I wonder if anyone has bothered to play with providing effective keyboard support for a list view control.

hmmmm,

This appears to be close to what I need. In a subclass for the list view control from a WM_KEYUP message.


SendMessage,hWin,LVM_GETNEXTITEM,-1,LVNI_FOCUSED
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Tedd

Not sure what your issue is here.

There's the focus rectangle (dotted) which moves with the arrow keys. The selection (blue) usually follows the focus.
Holding shift will allow multiple items to be hilighted (selected), the focus is the 'last' item in the selection.
Holding ctrl will move the focus without changing the hilight. While holding ctrl, extra items can be added to the selection by pressing space.

Short version: multiple items can be hilighted, but only one can have the current focus.

If you really want the focus rectangle on multiple items, I suppose you could do custom-draw, but I think it would just look ugly.
No snowflake in an avalanche feels responsible.

hutch--

It was the LVM_GETNEXTITEM that did the job, once I could get the item index the rest was simple. I am using the keyboard processing to do the alternative to mouse clicks and a submenu, it runs the selected file on enter and I have set it up to delete the selected file on delete. The best response was from a subclass of the list view control that did not internally use the WM_KEYUP message so it was no problems to run the code from there.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php