Solved

ItemStateListener in List and TextBox

Posted on 2004-08-17
7
498 Views
Last Modified: 2011-09-20
1. How can i detect whether the item is change in a list? E.g. user scroll up and down on the list.

2. How can i detect user is entering some word in the textbox?

thanks
0
Comment
Question by:hawkly
  • 4
  • 3
7 Comments
 
LVL 15

Expert Comment

by:jimmack
ID: 11819996
1) Off the top of my head, I'd say that you can detect the scroll actions on a list, only when a selection is made (ie. changing the state).  This is really more appropriate for a ChoiceGroup rather than a list.

2) You can't use an ItemStateListener on a TextBox, because a TextBox extends Screen, not Item.  You can have an ItemStateListener on a TextField, if that helps.
0
 

Author Comment

by:hawkly
ID: 11826836
>> I'd say that you can detect the scroll actions on a list, only when a selection is made (ie. changing the state).  This is really more appropriate for a ChoiceGroup rather than a list.

is't something like this:
public void commandAction(Command c, Displayable s)
{
      if (c == List.SELECT_COMMAND || c == cmOkOptions)
      {
            switch (myList.getSelectedIndex())
            {
                  case 0:
                        break;
            }
      }
      else if (c == cmBackOptions)
      {
            display.setCurrent(backScreen);
      }
}

>> You can't use an ItemStateListener on a TextBox, because a TextBox extends Screen, not Item.  You can have an ItemStateListener on a TextField, if that helps.

is't possible to have onkeypress event?


Actually what i want to do is when the user is scrolling the list or entering something in the textbox then i will set display.flashBacklight(10000);

so any idea on how to implement this?

thanks
0
 
LVL 15

Expert Comment

by:jimmack
ID: 11828690
The commandAction will only be called when the user activates one of the commands in the list (eg. by pressing the button in the centre of the joypad).  Moving a selection up and down in a list doesn't generate any events that you can capture.

There is no onkeypress event for the high level GUI widgets.  Canvas has keyPressed(), keyRepeated() and keyReleased().

If you're using MIDP-2.0, you could create your own CustomItems.  This should allow you to capure the keyPressed/Repeated/Released events.

0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:hawkly
ID: 11828813
>> The commandAction will only be called when the user activates one of the commands in the list (eg. by pressing the button in the centre of the joypad).  Moving a selection up and down in a list doesn't generate any events that you can capture.

How can i capture moving a selection up and down in a list ?

thanks
0
 
LVL 15

Expert Comment

by:jimmack
ID: 11828857
AFAIK you can't do this.  It's totally under the control of the operating system/virtual machine implementation.
0
 

Author Comment

by:hawkly
ID: 11828937
I'm interesting on the CustomItems. So where can find the tutorial, API and sample code?

thanks
0
 
LVL 15

Accepted Solution

by:
jimmack earned 125 total points
ID: 11829045
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Multi-source agreements are important because they set standards that all manufacturers should follow to ensure that devices are compatible with multiple vendors. The multi-source agreement (MSA) is an agreement that establishes how multiple vendors…
This article is a step by step guide on how to create a basic PTP link using Ubiquiti airOS devices. This guide can be used on the following Ubiquiti AirMAX devices. Nanostation, Bullets, AirBridge, Nanobeam, NanoBridge to name a few. Please review …
This Micro Tutorial will show you how to maximize your wireless card to its maximum capability. This will be demonstrated using Intel(R) Centrino(R) Wireless-N 2230 wireless card on Windows 8 operating system.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now