×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    33

    Predictive Text in Full Screen

    Hi all,
    I want to implement a chat where the user can input the messages using the built-in predictive text of the device.

    Ive seen that if the mobile is midp 2.0 and I add a TextField, the text can be written with T9. But can a TextField and hence the Form that contains it, be displayed in fullscreen mode?

    I think that it is not possible since setFullScreenMode belongs to Canvas class, but I have seen that it is possible to do in j2mepolish so, even if it's complicated it can be done with basic MIDP or even using any Nokia library,cant it?

  2. #2
    Registered User
    Join Date
    Feb 2005
    Posts
    6

    Re: Predictive Text in Full Screen

    what it is that you want to do really?

    You want to input String but you want your text field to be in full screen?

    Do you want something like inputting in a bigger screen than textbox, like that of a native compose message screen when we are sending a sms?

  3. #3
    Registered User
    Join Date
    Apr 2006
    Posts
    33

    Re: Predictive Text in Full Screen

    What I want is having a screen where different contents are gonna be shown and I want those contents displayed in FullScreenMode.

    That is the first requirement, the second one is that one component of that screen must be one that allows the user to input text using predictive text. That component itself doesnt need to be big, so a simple TextField is appropriate.

    My doubt is if these two requirements are compatible in any variant of MIDP since in MIDP 2.0 the FullScreenMode is only available in the Canvas class, and the text-based components like TextBox or TextField are related to the Screen class which we know cannot be mixed with Canvas.

  4. #4
    Regular Contributor
    Join Date
    Aug 2006
    Posts
    307

    Re: Predictive Text in Full Screen

    One way to implement such chat application is by using the standard Form as the main GUI class, and reallocate string items as the new messages are sent or received. This way you don't have to do anything with the TextField.

    The other way is to use the TextBox and the Canvas. In this case you draw the GUI totally by youself, and when user presses some buttons (let's say keys from 0 to 9, or FIRE), you call the Display.setCurrent(textBox) method.

    After that the text box appears on the screen, so user may enter new message. When user will press the OK button, the commandAction() method of the Canvas will be called, and in that case you should call the Display once again, and put Canvas for view: Display.setCurrent(canvas).

    Here the pseudocode:
    Code:
    public class ChatCanvas extends ScreenCanvas implements CommandListener {
    
        private TextBox textBox = new TextBox("Say", "", 160, TextField.ANY);
        private Command OK = new Command("Ok", Command.BACK, 1);
        private String message = null;
    
        private Display display = null;
    
    
        public ChatCanvas(Display display) {
    
            this.display = display;
    
            setFullScreenMode(true);
            
            textBox.addCommand(OK);
            textBox.setCommandListener(this);
            
        } // end constructor
    
    
        protected void showNotify() {
            display.setCurrent(this);
        }
    
    
        protected void paint(Graphics g) {
    
            // draw your chat GUI here
    
        } // end paint
    	
    	
        public void keyPressed(int keyCode) {
    
            int action = getGameAction(keyCode);
    		
    	switch (action) {
    
                case UP:
                    // scroll chat
                break;
                case DOWN:
                    // scroll chat
                break;
                case FIRE:
                    activateTextBox(); // write a new message
                break;
    
            } // end switch
    
        } // end keyPressed
    	
    
        public void activateTextBox() {
    
            textBox.setString("Enter new message");
            display.setCurrent(textBox);
    
        } // end activateTextBox
    
    
    
        private void deactivateTextBox() {
    
            display.setCurrent(this); // the chat GUI back
    
            // get text from text box and send it to the chatting server
    
        } // end deactivateTextBox
    	
    	
    	
        public void commandAction(Command command, Displayable d) {
    
            if ( c == OK ) {
    
                deactivateTextBox();
    
            }
    
    
            repaint();
    
        } // end commandAction
    
    } // end ChatCanvas
    Etc.

    The last way is a tricky one, and requires to draw the GUI totally by youself, but it's a cool one. The first way is the simplest and the most portable across many mobile phones.

  5. #5
    Registered User
    Join Date
    Apr 2006
    Posts
    33

    Re: Predictive Text in Full Screen

    Hello axs,
    first of all, thanks a lot for your reply.
    One way to implement such chat application is by using the standard Form as the main GUI class, and reallocate string items as the new messages are sent or received. This way you don't have to do anything with the TextField.
    The problem with this solution is that if I use the standard Form, I cannot use the setFullScreenMode() option, can I?

    The last way is a tricky one, and requires to draw the GUI totally by youself, but it's a cool one. The first way is the simplest and the most portable across many mobile phones.
    The problem with that one is that the user wont be able to use Predictive Text.

    I think that the only solution is the second one you talk about, mixing Canvas (with FullScreenMode) and a TextBox (or a Form with a TexField) to input the text (not to display it) in two different screens and switching from one to the other.

    But the thing is that Ive seen that with J2MEPolish it is possible to have a standard Form displayed in FullScreenMode, and I think they accomplished that through basic MIDP 2.0 Classes, and that is what I would like to do by myself.

Similar Threads

  1. full screen
    By ashrafzadeh in forum Mobile Java Tools & SDKs
    Replies: 5
    Last Post: 2006-07-03, 16:10
  2. Replies: 5
    Last Post: 2005-12-30, 18:27
  3. Full Screen Mode GPRS Connection Icon
    By murid in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2005-08-05, 14:46
  4. UI: Full Screen Mode
    By GENERAL_INFO in forum Symbian User Interface
    Replies: 3
    Last Post: 2004-11-22, 06:27
  5. Replies: 0
    Last Post: 2002-05-17, 12:09

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •