Solved

ItemStateListener in List and TextBox

Posted on 2004-08-17
7
497 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Need WiFi? Often, there are perfectly good networks that don't have WiFi capability - and there's a need to add it.  - Perhaps you have an Ethernet port into a network but no WiFi nearby. - Perhaps you have a powerline extender and no WiFi at the…
Working settings for French ISP Orange "Prêt à Surfer" SIM cards for data connections only. Can't be found anywhere else !
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…

758 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

18 Experts available now in Live!

Get 1:1 Help Now