Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Pocket PC - Auto completion
Pocket PC - Auto completion [message #443498] Sat, 25 September 2004 15:24 Go to next message
No real name is currently offline No real nameFriend
Messages: 21
Registered: July 2009
Junior Member
Hello,

I have written a application for the Pocket PC to mobile input of technical
datas.
In some text fields there are to input longer descriptions with frequently
longer
difficult words and it would be nice if tis will be shown in the auto
completion of Windows Mobile.
It is possible to influence this Pocket PC ability to add own words which he
don't know.
Very great would be to show this autocompletion words in dependance of the
text box (more often
immediately the right word) and give the preference to my technical
expressions.

Any help for this really special topic is very appreciated!

Thank you, Tobi
Re: Pocket PC - Auto completion [message #443538 is a reply to message #443498] Mon, 27 September 2004 16:20 Go to previous messageGo to next message
Christophe Cornu is currently offline Christophe CornuFriend
Messages: 304
Registered: July 2009
Senior Member
Hi,

That's not currently supported. Please open a feature request and mention if
you know other native apps that do that.

A less elegant workaround is to emulate form completion without using the
SIP completion feature. e.g. the code belows brings up different words when
the user types in 'sw' 'swt'. User can press the stylus on the label that
shows the hint on the last word to enter that word.

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.*;

public class PR {

static String hint = null;
static int index = 0;
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display, SWT.RESIZE | SWT.CLOSE);
shell.setText("PR");
shell.setLayout(new FillLayout());
final Text text = new Text(shell, SWT.SINGLE);
final Label label = new Label(shell, SWT.SINGLE);
text.addListener(SWT.Modify, new Listener() {
public void handleEvent(Event event) {
String string = text.getText();
index = string.lastIndexOf(' ') + 1;
if (index == -1) index = 0;
String lastWord = string.substring(index, string.length());
System.out.println(string +" / ["+lastWord+"]");
if (lastWord.length() == 0) { label.setText(""); return; }
if ("sweet snippet".startsWith(lastWord)) hint = "sweet snippet";
else if ("swt native widget toolkit".startsWith(lastWord)) hint = "swt
native widget toolkit";
else hint = "";
label.setText(hint);
}
});
label.addListener(SWT.MouseDown, new Listener() {
public void handleEvent(Event event) {
if (hint != null && hint.length() > 0) {
String value = text.getText();
String newValue = value.substring(0, index) + hint;
text.setText(newValue);
text.setSelection(newValue.length());
}
}
});
shell.open();

while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
}
Re: Pocket PC - Auto completion [message #443630 is a reply to message #443538] Tue, 28 September 2004 20:30 Go to previous message
No real name is currently offline No real nameFriend
Messages: 21
Registered: July 2009
Junior Member
Hello,

Thanks a lot for your very detailed answer!

Tobi
Previous Topic:Pocket PC - Screen keyboard
Next Topic:[SWT 2.1] Problem with ScrolledComposite
Goto Forum:
  


Current Time: Thu Apr 25 06:52:29 GMT 2024

Powered by FUDForum. Page generated in 0.03266 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top