On Sep 25, 2006, at 2:50 PM, Dr Gerard Hammond wrote:

Hi,

I am writing a RBscript text editor for one of my apps. I have added syntax highlighting, such that is now looks like the RB IDE. Now I want to add a tooltips feature that displays the API for my exposed context classes.

My first thought was to add my api call as a dictionary.

  RBapi = new dictionary
RBapi.Value("BooleanToStringTrueFalse") = "BooleanToStringTrueFalse(theBool as boolean) As string"

This works great. Now my editor has api help info when the user clicks inside any (RBapi key value) word in the editor (eg BooleanToStringTrueFalse)

But to improve this, as I type, I want the editor to show me the best guess, for eg: when I type "BooleanToSt" At this point I want the tooltip to show the help for this BooleanToStringTrueFalse?

Any ideas? I thought of adding making the dictionary cover all options.

eg

  RBapi = new dictionary
RBapi.Value("B") = "BooleanToStringTrueFalse(theBool as boolean) As string" RBapi.Value("Bo") = "BooleanToStringTrueFalse(theBool as boolean) As string" RBapi.Value("Boo") = "BooleanToStringTrueFalse(theBool as boolean) As string" RBapi.Value("Bool") = "BooleanToStringTrueFalse(theBool as boolean) As string" RBapi.Value("Boole") = "BooleanToStringTrueFalse(theBool as boolean) As string" RBapi.Value("Boolea") = "BooleanToStringTrueFalse(theBool as boolean) As string" RBapi.Value("Boolean") = "BooleanToStringTrueFalse(theBool as boolean) As string"
...
...
...
RBapi.Value("BooleanToStringTrueFalse") = "BooleanToStringTrueFalse(theBool as boolean) As string"

This seems wasteful and clunky

Can I look for a fragment of a key from a dictionary?
Any other ideas?

a tri
something like a dictionary of dictionaries of dictionaries (or arrays of arrays of arrays, etc)

For each "level" in a tri you have only single characters
You only need enough letters to uniquely identify anything for any prior letter

So, say you have two methods ABC and AB
You only need enough letters to distinguish the two cases

So your tri might be something like
   A
      A
      B <<< could be AB or ABC
        C <<< must be ABC they meant
      C
      D
      E
      etc
   B
   C
   D
 etc

Fast and relatively efficient as you only need to store what exists, and not everything else And you can add and remove from this fairly quickly and extend it as much as you want

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to