Author Topic: Unselect in Listview  (Read 2929 times)

Brian Reynolds

  • Newbie
  • *
  • Posts: 22
    • View Profile
Unselect in Listview
« on: September 20, 2021, 06:16:01 pm »
I have a Listview which, when I edit a line, the columns of text are copied to text boxes.
After editing I then click on a button to replace the text in the listview.
If I wish to immediately edit the line again, nothing happens when I click on it because it is already still "selected".
I have tried a few different ways to unselect the item but the only way I can find is to select another item then go back to the original.
My customer is not happy with this way of doing things and wants me to fix it.
Can anyone help?

Chris Boss

  • Administrator
  • Jr. Member
  • *****
  • Posts: 60
    • View Profile
Re: Unselect in Listview
« Reply #1 on: September 21, 2021, 08:33:16 pm »
There are different approaches I can think of.
The easiest would be to simply use a Global variable and store the last selected item index. The user need not click the same item again to move the data.

Add a button which which is used for the event to Move the data.

If you want to move the data by clicking on the listview use the double click event instead.

Another trick would be to subclass the control and process the %EZ_LButtonDown message and calculate which item it is clicked on.

Chris Boss

  • Administrator
  • Jr. Member
  • *****
  • Posts: 60
    • View Profile
Re: Unselect in Listview
« Reply #2 on: September 21, 2021, 08:39:16 pm »
You can change a listview items "state" by using the EZ_SetLVItem command using just the "{S}" (state) property.  You pass an additional S for Selected (otherwise unselected) and F for Focus (otherwise no focus. The property string would be:

"{S}"

to turn off both selected and focus state

"{S}SF"

to turn ON both selected and focus state

Brian Reynolds

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Unselect in Listview
« Reply #3 on: September 27, 2021, 02:15:15 am »
Chris,
Thank you for your help.
I used "{S}}" and that worked
Thanks.
P.S.: I noted that somewhere it said my age was N/A. (It's 85).
At first I thought it meant "Not ageing"
Regards,
Brian Reynolds.