Board index » delphi » How to avoid deselecting item when ListBox.Items.Exchange

How to avoid deselecting item when ListBox.Items.Exchange

When using a ListBox I would like to give the user the ability to
rearange the items in the list. This i do with to speedbuttons, one
for moving the item upwards in the list, and one for moving the item
downwards.
What happens is that when I move a item either way,the listbox
deselects that item.
This means that if I want to move a item two steps up, I must first
select the item, press the 'up'-button, select the same item and press
the 'up'-button again.
I'd like to avoid deselecting the item so that the user only has to
select item, and press the button twice.

Is this possible?

Pedro

 

Re:How to avoid deselecting item when ListBox.Items.Exchange


On Thu, 09 May 1996 08:55:26 GMT, pedro.thormod...@login.eunet.no

Quote
(Pedro E. Thormodsen) wrote:
>When using a ListBox I would like to give the user the ability to
>rearange the items in the list. This i do with to speedbuttons, one
>for moving the item upwards in the list, and one for moving the item
>downwards.
>What happens is that when I move a item either way,the listbox
>deselects that item.

Set the ItemIndex property to the item's new index.
--
Ray Lischner                              li...@tempest-sw.com
Tempest Software, Corvallis, Oregon, USA  http://www.tempest-sw.com

Re:How to avoid deselecting item when ListBox.Items.Exchange


Quote
In article <31937172.51692...@news.proaxis.com> li...@tempest-sw.com (Ray Lischner) writes:
>From: li...@tempest-sw.com (Ray Lischner)
>Subject: Re: How to avoid deselecting item when ListBox.Items.Exchange
>Date: Fri, 10 May 1996 16:48:38 GMT
>On Thu, 09 May 1996 08:55:26 GMT, pedro.thormod...@login.eunet.no
>(Pedro E. Thormodsen) wrote:
>>When using a ListBox I would like to give the user the ability to
>>rearange the items in the list. This i do with to speedbuttons, one
>>for moving the item upwards in the list, and one for moving the item
>>downwards.
>>What happens is that when I move a item either way,the listbox
>>deselects that item.
>Set the ItemIndex property to the item's new index.
>--
>Ray Lischner                              li...@tempest-sw.com
>Tempest Software, Corvallis, Oregon, USA  http://www.tempest-sw.com

If you allow multiselect in the list box, you should use the
"selected" indexed property

Other Threads