Solved

ItemStateListener in List and TextBox

Posted on 2004-08-17
7
502 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 to Defend Against the WCry Ransomware Attack

On May 12, 2017, an extremely virulent ransomware variant named WCry 2.0 began to infect organizations. Within several hours, over 75,000 victims were reported in 90+ countries. Learn more from our research team about this threat & how to protect your organization!

 

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

Webinar June 1st - Attacking Ransomware  

The global cyberattack that corrupted hundreds of thousands of computer systems on May 12th had a face, name, & price tag that we’ve seen all too often in recent years: Ransomware. With the stakes – and costs – of a ransomware attack higher than ever, is your business prepared ?

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…
In this article we have discussed about the OS X EI Capitan and how to fix Wi-Fi issue in OS X El Capitan. We have explained how to delete system level preferences and create a new Wi-Fi location to resolve Wi-Fi issue.
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…

751 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