Parameter display popup?

I have a simple editor which uses the CodeEditor component. When the user types a particular keyword into the editor I would like a small window to show up displaying suggested text to follow that keyword(as demonstrated in the attached picture). I’m not looking for an auto complete function, merely a popup window with some text on it. Any ideas how I would go about implementing something like this? I don’t even know if there is a way to find the xy coordinates of the caret so that I can position the widow in the right place.

Just make a Label child component of the component you want to have it above and position it via Component::getMouseXYRelative().

Great, I’ll look into doing it like that. Thanks.

getMouseXYrelative won’t give me the coordinates of the text caret. I would like the label to appear just under the text caret?

Good request - I’ll certainly add a method to return the caret pos.

…no, hang on - you can already get it, using getCaretPos() and getCharacterBounds()…

That’s great Jules, I now have my popup window working great. One thing however. if my popup window is visible and users move to the next line it should become invisible. This doesn’t happen because I set it’s visibility in my codeDocumentChanged() method. Would it be difficult to add a codeDocumentKeyPressed() method that would give one access to the last key that was pressed, regardless of weather a change occurred or not?

You’re really asking for something like a “CodeDocumentActivityListener” that’ll hear about cursor movements, etc. I’ll probably need something like that myself for the jucer, so it’s likely to happen.

adding some pluggable listeners to allow the creation of autocompletion or suggestion popups would be cool indeed.
those listeners would be notified at any changes in the code, where was the caret position at that change, what kind of identifier was around the caret and which kind of operation has done (insert / delete / replace, separator, alpha-numeric, …). this way we can inspect easily what the user was doing and suggestions would come in a breeze.