Shoutbox

Popup ListBox - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Popup ListBox (/showthread.php?tid=86961)

Popup ListBox by 7d5 on 10-30-2008 at 09:02 PM

Hello ppl,

I was wondering if there was a way to create a "popup ListBox" that popups next to the cursor once you start typing. Something like the autocomplete feature that we see in modern IDEz.

Any suggestions?


RE: Popup ListBox by Matti on 10-31-2008 at 09:17 AM

Hmm, that's actually a good question. I think it's possible to do this by manually positioning the ListBox control just beneath the Edit control, then fill the list every time the text changes and hide it when the Edit control loses its focus. Although it'd require quite some code to get it working I'm afraid.

I'll try to find time to have a look at this today.


Hmm, seems like I misinterpreted your idea of auto-completion. I was thinking in the likes of a search bar where you'd get suggestions in a list below it. (see the Firefox search bar for example)

What you're asking for is an IntelliSense feature like we can see in the Plus! Live script editor or Visual Studio. This is much harder to do I'm afraid... :(

Anyway, if anyone was looking for something which can do this...
[Image: 5y1rxdzv-PlusScript-AutoComplete.PNG]
...check out the attachment. :)
RE: Popup ListBox by 7d5 on 10-31-2008 at 10:32 PM

Your answer is perfect...and thinking of it......it could actually be used like the intellisense feature. the Mozillla example u were implying means that it only checks to c if you're gettin' closer to any of the static choices available. But why have the choices static? isn't it possible to dynamically generate values in the listbox depending on the input in the textbox? 

-------------------------------------------------------------------

One more thing....can't i have this listbox appear on normal Wnd and not a PlusWnd? something like this

Exmaple


RE: Popup ListBox by Matti on 11-01-2008 at 08:00 AM

quote:
Originally posted by 7d5
But why have the choices static? isn't it possible to dynamically generate values in the listbox depending on the input in the textbox?
That's already implemented. Instead of passing an array as fourth argument to the constructor, you can pass a function in the following format:
code:
function AutoCompleteCallback(oAutoComplete, sInputText) {
     //oAutoComplete = the instance of the AutoComplete class
     //sInputText = the current text input
}
The function should then return an array of strings to display in the list. If you want to hide the list, simply return an empty array. So yes, you could implement all those fancy AJAX stuff and such. :P
quote:
Originally posted by 7d5
One more thing....can't i have this listbox appear on normal Wnd and not a PlusWnd? something like this

Exmaple
I'm afraid you can't. The Plus! Live scripting API gives us abilities to work with custom Plus! windows, but modifying a chat window isn't possible. It'd require advanced hooking methods such as the ones Plus! Live uses, but I think enabling this for use by scripts would be very complicated and thus it's not available to use by scripts.

I can assure you: if it would have been available to scripts, you'd already have seen a script using it somewhere before! :P
RE: Popup ListBox by SmokingCookie on 11-01-2008 at 02:16 PM

It is possible. I have made an external command helper in my script Date Calculator which uses a hard-coded array of command parameters. You may want to twist it a bit with the AutoComplete class to allow for dynamic arrays and there you go.


RE: Popup ListBox by 7d5 on 11-07-2008 at 10:45 PM

Hello Matti,

I guess you triger the window by trying to right click on one of the contacts and then highlighting "Messenger Plus! features" which shows an extra item called "Open"

Is this how you show the autocomplete window?