Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

Select item above or below in listview

Hi there,

I have a Listview component, with 5 items in it, when I select say, the 3rd item I want a button that I can click to move the selection pointer (not the item) up or down. So basically it just moves up or down the list - not the item, just the selection.

I tried lvItems.selected.index + 1 but that didn't work.

Many thanks
Nick
0
wildzero
Asked:
wildzero
1 Solution
 
BarthaxCommented:
Bah! My Delphi is rusty... Try setting the selected property of the individual item to true.  Off the top of my head (I don't have Delphi to hand and rely far too much on the auto-features of Delphi!) try something like:

lvitems.items[lvitems.selected.index + 1].selected := true;

Again, apologies for the rustiness!
0
 
mikelittlewoodCommented:
lvItems.Items[lvItems.ItemIndex-1].Selected := True;
lvItems.Items[lvItems.ItemIndex+1].Selected := True;
0
 
wildzeroAuthor Commented:
Awesome :-)
Thank you!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now