Question concerning Incremental Search - Like Help Index faq184-3842
Question concerning Incremental Search - Like Help Index faq184-3842
(OP)
I tried that code (written by craigsboyd) and it works fine.
Now I wanted to have this code as an additional feature in a form which I created myself.
But I have problems to integrate that, when I implement a click-button on my form which has the code written by craigsboyd in its click-event.
VPF then says :
"Methods and events cannot contain nested procedures or class defintions"
I am sorry that I am not experienced with classes - but perhaps anyone here could help with a solution to add this useful code by craigsboyd to a form which already exists.
Thanks in advance.
Keep healthy...
Klaus
See FAQ184-3842: Incremental Search - Like Help Index
Now I wanted to have this code as an additional feature in a form which I created myself.
But I have problems to integrate that, when I implement a click-button on my form which has the code written by craigsboyd in its click-event.
VPF then says :
"Methods and events cannot contain nested procedures or class defintions"
I am sorry that I am not experienced with classes - but perhaps anyone here could help with a solution to add this useful code by craigsboyd to a form which already exists.
Thanks in advance.
Keep healthy...
Klaus
See FAQ184-3842: Incremental Search - Like Help Index
Peace worldwide - it starts here...
RE: Question concerning Incremental Search - Like Help Index faq184-3842
whenever you edit a method or event in the visual designer, you have to imagine your code written within PROCEDURE method/eventname() and ENDPROC. You can't embed further methods/events within a method/event. This kind of nesting code is not allowed. Even less so a whole class definition with objects and object methods.
The essential code you need from the FAQ is the interactivechange event code for the listbox and textbox. So you have to pick out the code in the interactivechange events and put them into your visual controls interactivechange vents.
On the other side look into the autocomplete feature of a VFP9 textbox, which gives you alternative options by just setting a few properties and having the data the user should be able to incrementally search in a table with a certain structure. Can't tell you from the top of my head, but simply lookup autocomplete in VFP's help.
Chriss
RE: Question concerning Incremental Search - Like Help Index faq184-3842
What you are trying to do is to incorporate that code into an existing form. That's not going to work. Instead of simply copying the code, you should try to understand what it is doing and how it works, and then use those same ideas (not necessarily the same code) in your own application.
That said, there are easier ways of implementing incremental search. My preference would be to use a textbox with its AutoComplete property set to 1 (as suggested by Chris above).
Or, for a simpler implementation, just set the listbox's IncrementalSearch to .T. It's not as flexible as the other methods, but much easier to implement.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads
RE: Question concerning Incremental Search - Like Help Index faq184-3842
Your suggestions will help me very much.
Greetings from Western-Germany
Klaus
Peace worldwide - it starts here...