May 06, 2024, 04:04:04 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Highlighting in a ListView

Started by Jim Scott, February 14, 2007, 10:36:45 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jim Scott

Hi all,

I've got a ListView with multiple columns and rows.  I've added an Edit control above this ListView to act as a Find function.  It all works great.  My question is once I've found the row and column that contain the text in the search, what's a good way of hightlighting the find?

I've tried setting @LVSETSELECTED to the row number to highlight the entire row.  Ideally, I'd like to highlight just the cell where the text was found but the entire row would be ok.  I'm toying with the SendMessage command, but I don't what I'm doing and having no success.  Is there a way to Refresh a ListView so that manually set selected items would show up highlighted, just as when it is mouse clicked?  Is it possible to have my code scroll the list so that the now highlighted cell or row show up at the top or center of the control?

Any help is appreciated,

Jim Scott
Jim Scott

Ionic Wind Support Team

See the example program listvew_noresize.eba included with the installation.  It shows how to set the extended styles of a listview control, including full row selection.

CONST LVM_FIRST = 0x1000
CONST LVM_SETEXTENDEDLISTVIEWSTYLE = (LVM_FIRST + 54)
CONST LVS_EX_FULLROWSELECT = 0x20
CONST LVS_EX_GRIDLINES = 1
CONST LVS_EX_FLATSB = 0x100
CONST LVS_EX_LABELTIP = 0x4000


'use in @idinitdialog if in a dialog.
SENDMESSAGE d1,LVM_SETEXTENDEDLISTVIEWSTYLE,0,LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES,100
Ionic Wind Support Team

Jim Scott

If I'm not mistaken, that just allows for full row selection on a mouse click.  Is that right?  My program is doing that just fine.  I was wondering if its possible to have my program change the selected and highlighted row based on my search results?

Jim Scott
Jim Scott

Ionic Wind Support Team

Using LVSETSELECTED should highlight the entire row after that.
Ionic Wind Support Team

Jim Scott

I just found
CONTROLCMD  win,idArrivalList,@LVSETSELECTED,FindRow
REDRAWFRAME win,idArrivalList

I was setting it all along, just didn't see it.  Thanks Paul.
Jim Scott

Bruce Peaslee

I tried this technique. It works in the @IDINITDIALOG section. The line I want highlighted, the first one, is.

I have some buttons on the side that work on the data selected, and, as part of the process, the highlight is moved down one line. My little problem is that the original highlight is blue, but when it moves down, it becomes gray.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Ionic Wind Support Team

Ionic Wind Support Team

Bruce Peaslee

Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles