|
Re: Content proposal (auto complete) of StyledText [message #507462 is a reply to message #506545] |
Wed, 13 January 2010 14:52 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
Hi,
I don't know if this is quite what you're looking for, but since no other
answers have surfaced I thought this could be helpful. Snippet
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet320.java?view=co
demonstrates a basic implementation of content assist at the swt level.
Grant
"Helmut Neubauer" <helmut.neubauer@cognidata.de> wrote in message
news:hi5mdu$che$1@build.eclipse.org...
> I'm looking for an example to implement content proposal features in a
StyledTexted control but I failed.
>
> I tried to adapt this code snippet I found for a Text instance:
> // "." and "#" will also activate the content proposals
> char[] autoActivationCharacters = new char[] { '.', '#' };
> KeyStroke keyStroke;
> try {
> keyStroke = KeyStroke.getInstance("Ctrl+Space");
> // assume that myTextControl has already been created in some way
> ContentProposalAdapter adapter = new ContentProposalAdapter(text,
> new TextContentAdapter(),
> new SimpleContentProposalProvider(new String[] {
> "ProposalOne", "ProposalTwo", "ProposalThree" }),
> keyStroke, autoActivationCharacters);
> } catch (ParseException e) {
> e.printStackTrace();
> }
>
> text should be a StyledText object. It doesn't work. Please help. Thanks.
>
|
|
|
Re: Content proposal (auto complete) of StyledText [message #532904 is a reply to message #507462] |
Tue, 11 May 2010 14:19 |
Sam Hazim Messages: 2 Registered: May 2010 |
Junior Member |
|
|
Thanks Grant, for the original example Snippet320 - very helpful.
I do have an issue with it that is proving difficult to resolve.
Basically, once our popupShell appears, it can sometimes contain so many TableItems that it displays a scrollbar. There are three main actions in this 'problem'.
(1) From here, the user clicks the scrollbar. The click does not register, and the popupShell visibility is lost.
Step (2) - now, the user enters more text (to redisplay the popupShell) and then proceeds to click on the table area itself. Now they have focus on the table and can proceed to click and drag on the scrollbar, which works as intended.
Now the final step (3). Once (2) has been done, the user can then go back to the text box and start typing away. Focus remains on the text box where they are typing, and the popupShell is displayed. The user can click their mouse directly on the scroll bars (keeping their text entry active on the text box) and the scroll bar clicks work as intended.
To demonstrate this it may be useful to modify Snippet320 to use 50 items in the loop instead of the current 5.
So my question is, how can I enable the use of the scrollbar from the very second it is generated, without having to force the user to click on the table area itself (which is not intuitive).
Thanks for your help, and your helpful example.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03901 seconds