Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ItemStateListener in List and TextBox

Posted on 2004-08-17
7
Medium Priority
?
507 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
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 

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 500 total points
ID: 11829045
0

Featured Post

WatchGuard Case Study: Museum of Flight

“With limited money and limited staffing, we didn’t have a lot of choices in terms of what we could do to bring efficiency. WatchGuard played a central part in changing that.” To provide strong, secure Wi-Fi access within the museum, Hunter chose to deploy WatchGuard’s AP120 APs.

Question has a verified solution.

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

MAC Filtering: MAC filtering is like handing a list of names to a doorman. If someone comes to the door and mentions a name, this name is checked by the doorman on his list and granted or denied access by this. This means that if someone menti…
Using in-flight Wi-Fi when you travel? Business travelers beware! In-flight Wi-Fi networks could rip the door right off your digital privacy portal. That’s no joke either, as it might also provide a convenient entrance for bad threat actors.
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…

971 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