Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding some sort of intellisense to VFP editboxes
Message
From
13/02/2017 10:57:51
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
13/02/2017 07:07:38
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01647873
Message ID:
01647904
Views:
66
>Hi all of you VFP die-hards and gurus,
>
>I am currently in the process of adding some scripting to a good old "plain-vanilla" (well nearly so...) VFP application. The text parsing functionality - pretty simple - was no problem. The grammar is indeed pretty simple.
>
>Now come the time to enhance the user-experience when they build the scripts - it's an expression language not a full interpreter of course. At the current junction, bringing some sort of intellisense/autocompletion to the editbox where type occurs would be a great addition.
>
>Any idea how this could be performed in a decently "simple" way? What is needed? Some sort of autocomplete à la notepad++ (see attachment).
>
>A this stage, I am not looking to import the VFP smart command editing language functionality at all. We'd just be glad to find some quick fix that would reduce users typing would be great! We try to avoid heavy dependencies on this very compact application, so no smart solution that would involve smart DSL design is in the pipe nor using external widgets. Just plain hacking of the vfp toolset to enhance the user-experience:)

I did that in 2.6... and then years later seen it done in VFP. Usually it's something to trigger the display of the dropdown; back in 2.6 it was an OnKeyLabel. Later, it's editbox.keypress which would react to a certain key, usually an underscore or @ (i.e. something easy to type but not regularly a part of the text). In your case, you'd have to have your code triggered somewhere in either keypress or interactivechange, where you'd check for the last word in front of .SelStart and then decide what to do with it.

This should be relatively simple, you could pull the candidate words/phrases into a cursor or array, build a listbox around that and then just display it. The tricky part would be to position it close enough to the cursor on screen, and then if the user chooses a value from it (keypress of tab or enter, doubleclick), replace this last word with the selection, or do nothing if user doesn't (hide the listbox, set focus back to editbox, make sure .selStart didn't change).

Now replacing may be tricky, at least in my experience - I'm launching a whole selector form (because I'm not doing real intellisense here, I'm inserting names from a long list, so it's displayed in a whole form with incremental search), and when the focus passes back to the caller form, the inserted word is not always where I expect it to be. The .selstart seems to be relative to .text and not .value property, or the error in positioning is more due to the number of paragraphs (do they count as 1 or 2 chars, the .selstart sometimes counts them this way sometimes that way, still not sure what and when).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform