Hi Art,
I've never tried something like that, but this is how I would start.
Set an exposed variable to the empty string. Connect the onChar event to
the listbox. When the event handler is invoked, append the character to
the exposed variable. Then use the find() method using the exposed
variable string as the textOrPrefix, probably the current index as the
startIndex, and exact as false.
If you get a hit, move the selection to the returned index. Each time a
new character comes in, it is appended to the current search string and
find() is invoked again. I think that should get you close, then you run
it and see what doesn't work.
You want to set up your onChar handler so that the character is not passed
on to the listbox. I'm hoping the docs are sufficient for you to determine
how to do that. I'm not being secretive, if I remembered off of the top of
my head I'd just tell you.
One thing that thing I can think of that might take a little thought is
what to do if the find() does not produce a hit.
Also, you'll need to figure out when to set the search string back to the
empty string.
Let me know if you are having problems. If I have a little time, I'll
probably play with it a bit.
The other thing is, the listbox seems to already have a search function
built in. You do realize that don't you? I suspect you are asking because
the built in procedure is not sufficient for what you want. I don't have
any example programs around that have very many items in a listbox, but it
seems to work somewhat.
--
Mark Miesfeld
On Sun, Jun 30, 2013 at 10:33 AM, Art Heimsoth <[email protected]>wrote:
> I am trying to locate a string in a listbox by typing the characters, but
> I want the number of characters to be variable. For example, in looking
> for names in a listbox, I would like to start typing and for each character
> bring up the next matching string. I am using Find and I understand
> I can specify a multiple character string, but I would like for the listbox
> find to select the first item matching the first character, allow me to
> enter another character and have the find select the string that now
> matches both characters, repeating until the Enter key is pressed where
> the Ok button would then cause the currently selected string to be
> retrieved, but how would I approach this? How would I define an
> onChar event on the listbox to allow me to build the string to be
> passed to the find? Any suggestions as to approach appreciated.
>
> --
> Art Heimsoth - [email protected]
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Oorexx-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/oorexx-users
>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Oorexx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-users