Hi all,
I'll skip my implementation and get straight to where my problem lies.
Put a TListBox on a form, give it some strings in it's Items property and run it. Give the ListBox the focus and press some keys - the selected item remains selected. Even if you capture the OnKeyPress and modify the value of the selected Item. This is the functionality I want.
However, my project needs the TListBox's Style property to be lbVirtual. The quick way of explaining this to the uninitiated is that the TListBox's strings that it displays are not stored in any of it's properties, and instead are provided by an OnData event, and must be displayed by an event linked to the OnDrawItem event. That part all works.
However, when I press a key - no matter which key - on my TListBox that's got it's Style property set to lbVirtual, it changes the ItemIndex to 0!
I've tried quite a few things, including overriding the KeyPress procedure, I've set the AutoComplete property to False, nothing seems to work. I'm using a descendant of TCustomListBox so I can play about a bit.
Anyone come up against this before? and how do I stop the ItemIndex from changing?
Using D6 Enterprise. Many thanks.
I'll skip my implementation and get straight to where my problem lies.
Put a TListBox on a form, give it some strings in it's Items property and run it. Give the ListBox the focus and press some keys - the selected item remains selected. Even if you capture the OnKeyPress and modify the value of the selected Item. This is the functionality I want.
However, my project needs the TListBox's Style property to be lbVirtual. The quick way of explaining this to the uninitiated is that the TListBox's strings that it displays are not stored in any of it's properties, and instead are provided by an OnData event, and must be displayed by an event linked to the OnDrawItem event. That part all works.
However, when I press a key - no matter which key - on my TListBox that's got it's Style property set to lbVirtual, it changes the ItemIndex to 0!
I've tried quite a few things, including overriding the KeyPress procedure, I've set the AutoComplete property to False, nothing seems to work. I'm using a descendant of TCustomListBox so I can play about a bit.
Anyone come up against this before? and how do I stop the ItemIndex from changing?
Using D6 Enterprise. Many thanks.