italiano english

Forum

Current User: Guest
Search 
Search Forums:


 




How I can create application with User Inputs?

Add a New Topic Reply to Post
UserPost

5:37 am
November 12, 2008


Sakthivel

Guest

I want to create application with Gear which supports user Inputs and actions based on the inputs.. How can i do this?

11:26 am
November 12, 2008


Paolo

Moderator

posts 11

User input is generally handled by classes inheriting from GWCanvas (thus also GWForm, GWList, GWGrid, etc…).

In Gear application (but in general in J2ME applications) there are 3 types of inputs available: commands (triggered by soft keys), keypad and touchscreen.


Adding command-based interaction support to your widget requires you to follow these 3 steps: make your widget implement “GWCommandListener” interface, register the class as a command listener by adding the “setCommandListener(this)” call to your widget constructor and finally add one or two commands to your widget using the “addCommand()” method (either using CommonCommands or custom created commands)


To handle keypad inputs (fire button and arrow keys) just override the proper methods in your widget ( rightArrowPressed(), leftArrowPressed(), upArrowPressed(), downArrowPressed(), and firePressed() ).


Touch screen events maybe handled in two different ways: as pointer events and as gesture based events.
To handle pointer events just override the proper methods in your widget ( gwPointerReleased(), gwPointerPressed() and gwPointerDragged() ).


To implement a gesture based interaction you should make your widget implement the “GWGestureListener” interface,  you should register the class as a gesture listener by adding the “setGestureListener(this)” call to your widget constructor and finally you should implement the GWGestureListener methods to associate actions to the different gestures.


Note that GWList, GWScrollableList, GWGrid, GWTextView and GWTextEdit are high level widgets which already handle keypad and pointer based input.


For more details you can download this java class extracted from the upcoming gear tutorial that shows how to handle some of the inputs described in the post.


I hope your question has been fully answered, for any request don’t hesitate to ask again.


6:20 am
May 4, 2009


Hiroki

Guest

I want make user text input field by GWTextEdit. But I can’t found sample code.
Please tell me how to use GWTextEdit.

Regards

Hiroki Mori
TOKYO JAPAN

11:56 am
May 5, 2009


Hiroki

Guest

Hiroki said:

I want make user text input field by GWTextEdit. But I can’t found sample code.
Please tell me how to use GWTextEdit.

Regards

Hiroki Mori
TOKYO JAPAN


I found it myself. thanks.

        protected boolean showCheck(Display display, EventArg eventArgs){

                if (eventArgs.getClass() == TextEditArgs.class){

                        TextEditArgs args = (TextEditArgs)eventArgs;

                        item.setLabel(args.getText());

                }

                return true;

        }


        public void itemClicked(ImageItem clickedItem) {

                EventManager.getInstance().enqueueEvent(new DisplayWidget(this, new GWTextEdit(), new TextEditArgs(this.getClass(), “Type your text”) ));

        }

1:05 pm
May 5, 2009


Paolo

Moderator

posts 11

Sorry for the late reply, but you found exactly the way to use it.

Could you please tell us (if it is no secreted in any way) what kind of project are you developing using Gear ?

Add a New Topic Reply to Post


Reply to Topic: How I can create application with User Inputs?

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 6 + 10        (Required)

Topic Reply:


 
© Simple:Press Forum - Version 3.1.3 (Build 356)  

Digitalapes - Via Enrico Fermi 84, Tavagnacco (Udine) - info@digitalapes.net