Scrolling AND selecting items in a ListField on the storm?

Background information:

BlackBerry Storm 9500

BlackBerry JDE 4.7.0

Problem:

I use a ListField to display several items in a list. I also use the touchEvent (TouchEvent message) method to listen to a click (TouchEvent.CLICK). Well, everything seems to work except when I need to scroll through the list. It seems that using the touchEvent method, I can't scroll through the list. If I remove the touchEvent method, scrolling works but I am unable to use the touch interface to select an item in the list by clicking on it.

Question:

Is it possible to get both? In other words, can enable scrolling in the ListField AND allow the user to select an item by clicking on it?

Code:

private class SlideList extends screen

{

Fields

private ListField _list;

Private _callback ListCallback;

Constructor

public SlideList()

{

Super();

Add a title screen

LabelField title = new LabelField (getTitle (), LabelField.ELLIPSIS |) LabelField.USE_ALL_WIDTH);

setTitle (title);

setupList();

}

Private Sub setupList()

{

If (_list! = null)

Delete (_list);

Get all the slides and put their titles and subtitles in a table

String [] slideTitles = getSlideTitles();

_list = new ListField();

_callback = new ListCallback();

_list.setCallback (_callback);

Build the list of exercise.

for (int index = 0; index)

{

_list. Insert (index);

_callback. Insert (slideTitles [index], index);

}

_list.setSelectedIndex (currentSlideNum);

Add (_list);

}

Get the touch input.

protected boolean touchEvent (TouchEvent message)

{

If (message.getEvent () is TouchEvent.CLICK)

{

Check if a list item is selected.

If (_list.getSelectedIndex () > - 1).

{

Dialog.Alert ("you selected:" + _list.getSelectedIndex ());

itemSelected (_list.getSelectedIndex ());

Returns true;

}

on the other

Returns false;

}

on the other

Returns false;

}

Private Sub itemSelected (int listIndex)

{

currentSlideNum = listIndex;

displaySlide();

UiApplication.getUiApplication () .popScreen (this);     Remove this screen to display the program.

}

private class ListCallback implements {ListFieldCallback}

private vector listElements = new Vector();

' public void drawListRow (list ListField, Graphics g, int index, int y, int w)

{

String text = (String) listElements.elementAt (index);

g.drawText (text, slideIcons [index] .getWidth () + 10, y, 0, w);

}

public Object get (ListField list, int index) {}

Return listElements.elementAt (index);

}

public int indexOfList (String p, ListField list, int s) {}

Return listElements.getSelectedIndex ();

Return listElements.indexOf (p, s);

}

public int getPreferredWidth (ListField list) {}

Display sr = UiApplication.getUiApplication () .getActiveScreen ();

Return sr.getWidth ();

}

public final void insert (String toInsert, int index) {}

listElements.insertElementAt (toInsert, index);

}

{} public void erase()

listElements.removeAllElements ();

}

}

}

Mark,

Thanks for your reply. It turns out that the solution I was looking for was very simple. Rather than return

fake

in the touchEvent method, I back

super.touchEvent (message)

While touchEvent can call its parent class and always look for other events inherent in a listenField, such as scrolling with a finger.

It now looks like this:

Get the touch input.

protected boolean touchEvent (TouchEvent message)

{

If (message.getEvent () is TouchEvent.CLICK)

{

Check if a list item is selected.

If (_list.getSelectedIndex () > - 1).

{

Dialog.Alert ("you selected:" + _list.getSelectedIndex ());

itemSelected (_list.getSelectedIndex ());

Returns true;

}

}

Return super.touchEvent (message);

}

Tags: BlackBerry Developers

Similar Questions

  • When you use the pen tool when I click and create an anchor point and release the mouse button the pen tool emerges from the anchor and allow me to go and select a new anchor point. The right pen tool keeps adding lines that I move the mouse.

    When you use the pen tool when I click and create an anchor point and release the mouse button the pen tool emerges from the anchor and allow me to go and select a new anchor point. The right pen tool keeps adding lines that I move the mouse.  How can I get the pen tool to release the anchor

    Try this.go in the menus. Select cc illustrator > preferences > display selection & anchor > then make sure the box "activate the rubber band for" the pen tool is not selected. Then press OK. It should work.

  • When one of my users start CC and select applications, nothing is displayed, only the arrow circling. What is c?

    When one of my users start CC and select applications, nothing is displayed, only the arrow circling. What is c?

    It is resolved, they did not have local Admin rights.

  • InDesign CC - square window missing layer "indicates selected items" (drag to move between the layers)

    Any body knows how to get the square in layers of window Panel to drag and drop items between layers?

    In indesign CS6 it works always, CC he disappeared suddenly...

    See screenshot of what I'm talking...Indesign_layer_item_indicater.jpg

    If it works in one account, but not another, delete two preferences of the account files which ha a problem and copy them from the account that works. If it fails again in no time you have a software conflict with another program that you run in this account.

  • Keyboard for blackBerry Smartphones locking and unlocking in my Pocket constantly on the storm.

    Problem I have is that the keypad lock / unlock at the top on the left always gets pushed in my pocket.  When this happens, all kinds of buttons are is pressed and it screwing and calling people.  I had the Blackberry World Edition where you had to hold down two keys to unlock.  Is this something I can do with the storm?

    Password, you can protect the unit.

  • When I click with the right button on the desktop and select 'New', I did not have the option 'folder '. Where at - it go?

    I have no way to create a new folder now.  A new fkolder does not appear even if I click on "new folder."  That's happened?  I had the opportunity to create a new folder until a few months ago, but I don't know what I did or what happened to the 'Record' option disappear from the 'New' when you right click on the desktop.

    You have installed chrome? It's looking like a recent update of chromium may be the cause. Here are two patches.

    How to remove and restore the default context Menu items 'New' in Windows 7 and Windows 8
    http://www.SevenForums.com/tutorials/28677-new-context-menu-remove-restore-default-menu-items.html

    If still no joy, see the 'response' by Linda Yan in this thread.
    http://social.technet.Microsoft.com/forums/en-us/w7itprogeneral/thread/97de8a2a-12f2-4381-A409-a78f4ae551cf/#99395761-56de-4a76-8C2A-eab498ad735a

    Tip: When you save the text in Notepad, the default file format is .txt. Replace all files.

  • How the my client can download files and new items on its website to the involved?

    I created a website for a client who wants to be able to add any new information to articles without having to go through me again.

    How is it?

    I added all the permissions to him as a user. I know how it can change the existing information on the site, but not to add something new.

    Thanks in advance

    Hi Tanya,

    At this stage it is not possible out of the box in the Muse to add articles, only you can change by using the Explorer Edition. To be able to add something without the participation of Muse, you will need to use a CMS system as a catalyst for the company, where you can install modules like items or disclosed to your client and they can add their since the backend itself, which will reflect instantly on the site.

    Since this feature is not here in the Muse at the present stage, I would recommend that you post it on our ideas here, https://forums.adobe.com/community/muse/ideassection, and let our team of devs know this requirement.

    - Abhishek Maurya

  • Can I need separate videos to allow a user to 'Play All' (from the beginning to the end) and select certain sequences (ceremony, reception which the sequence chosen start and end at the rest of the video and not the sequence, speech etc.)?

    Hi - I'm obviously new to yet, but that's what I want to do.

    In a wedding video, I want them to be able to:

    1 play the movie from start to finish.

    2. Select a sequence (say speech) who plays since the beginning of the sequence to the END of the whole video.

    So do I need 1 video for the room, as well as 4 sequences - reception, cake, speech, dance?

    Colin

    You can use separate videos or a single video. The only video is easier for your desired navigation. You will find more people asking how to get the 'chapter' or the video scene at the rear to a menu when it ends and also have a game all. So ignore the advice on those.

    Simple video:

    Your single video goes on a timeline. 'Play all' is a button in the timeline, and the timeline has an end action of "last menu."

    Menu of chapter has 4 buttons (plus a fifth to return to the main menu), going to each respective chapter marker. There is no action to end on chapter markers, so when a new chapter is reached, he continues to play as the piece all the.

    Several videos:

    Each video goes on his own script. The end of video action a timeline is timeline two video etc. Play all is a button that goes to the timeline one. The chapter menu also has a button go to chapter one, and it works identical to the play all. Each of the chapter buttons go to their respective chapter deadlines.

    Still may have some problems with a certain time lag, but I do not think that they affect either of these workflows. Don't rely on the preview again; burn a test disc and play on a DVD player.

  • No "replace selected item" or "Import options" check the box

    Hello, when I try to import an image in Indesign 2014.2 it seems the three checkboxes you normally see at the bottom of the import window (import options, change seleceted point and one more) are not visible. A known issue? And most important: a solution someone?

    Thank you

    Norbert

    Reinstalled the program, it is resolved. Thanks for your time Peter.

  • HP B8T40LA 1000: touchpad won't scroll and cannot open or connect with synaptics v7.5

    Hello

    Only the functionality of scrolling on the touchpad on my laptop HP 1000 does not work, when I try to open the Synaptics Touchpad V7.5 it says "cannot connect to the controller synaptics pointing device. Any help?

    Thank you.

    Hello

    Try the following.

    First, download the installer of the Synaptics driver from the link below and save it in your downloads folder.

    http://ftp.HP.com/pub/SoftPaq/sp62501-63000/sp62715.exe

    Then, open windows control panel, open programs and features, right click on the entry of Synaptics and select uninstall.

    Once done, restart the laptop.

    When windows has completely recharged, open your download folder, click with the right button on the setup of Synaptics and select "Run as Administrator" to launch the installation.  When this has completed, restart the computer again.

    Kind regards

    DP - K

  • Scrolling and volume bar does not not on my Pavillion dv7, model US notebook dv7-3060

    I have a Pavilion dv7, model: dv7-3060US notebook.  I upgraded my OS from Win 7 Home Premium to Win 7 Ultimate.  Since the upgrade, scrolling on the Touchpad, (is is not off,) no longer works.  More, the touch volume control does not work properly.  The small speaker above the keyboard icon does not turn orange when the sound is muted and the volume on the screen bar no longer displays when you adjust the volume.

    I saw other models with the same issue, but have not found an ad for my particular model.  Where can I find a solution to this problem

    Hello

    With regard to the volume bar, follow these steps.

    Download IDT Audio Installer on the link below and save it in your downloads folder.

    http://ftp.HP.com/pub/SoftPaq/sp48501-49000/sp48830.exe

    One time finished, open windows control panel, open Device Manager and open sound, video and game controllers.  Right click on the IDT device and select uninstall - also, you should get a command prompt to delete the current driver, check the box allow this and then proceed to uninstall.

    When finished, restart the computer and let Windows load completely.  Open your download folder, right-click on the IDT Installer and select "Run as Administrator" to launch the installation.  When this has completed, restart the computer again.

    Question for the TouchPad, first download the latest program install Synaptics driver from the link below and again, Save in your downloads folder.

    http://ftp.HP.com/pub/SoftPaq/sp49001-49500/sp49392.exe

    Then, open windows control panel, open programs and features, right click on the entry "Synaptics Pointing Device Driver" and choose uninstall.

    When this has completed, restart the laptop.

    When windows has completely recharged, open your download folder, click with the right button on the setup of Synaptics and select "Run as Administrator" to launch the installation.  When this has completed, restart the computer again.

    Now, follow the process under the heading "Setting horizontal and vertical scrolling" detailed in the link below.

    Configure the TouchPad.

    Kind regards

    DP - K

  • Determine the index of the selected items in a ListBox?

    Hello

    I can't find a simple/direct method to determine the index of the selected item in a list box.

    I feel I'm missing something, but I can't seem to figure out who (if any) returns an index number if you use it with the recall of .onChange for a ListBox control.

    The following code implements that I need, but is not particularly efficient or elegant and can get confused if you introduce multiple lists to check.

    Any suggestions to reproduce this behavior, even with the best code would be appreciated.

    Thank you!

    var RES = ' palette {text: 'Example-list' properties: {resizable: true}-} ".

    NLP: Panel {orientation: 'row', preferredSize: [400 600]------}

    list1: ListBox {preferredSize: [400 550], properties: {multiselect: true, numberOfColumns:2, showHeaders:true, columnTitles: ["list 1", "item 0"]}}, \

    }}"

    var win = new Window (res)

    Win.Show)

    for (i = 0; i < 10; i ++) {}

    var line = win.pnl.list1.add ("point", "Same entry")

    row.subItems [0] .text = ' paragraph '+ i}.

    Win.PNL.List1.OnChange = function() {}

    var tempArray = new Array()

    for (i = 0; i < win.pnl.list1.items.length; i ++) {}

    If (win.pnl.list1.items [i] .selected == true) {tempArray.push (i)}

    }

    selectedRow = win.pnl.list1.items var [tempArray [0]] .text

    var selectedRowSubitem = win.pnl.list1.items [tempArray [0]] .subItems [0]

    Alert ("selection:" + tempArray + "\n posted content:" + selectedRow + "\t" + selectedRowSubitem)

    }

    .. .in the same time, that should be enough

    win.pnl.list1.onChange = function() {
         alert(this.selection.index); // for this to work set, multiselect:false
    }
    

    I guess you already tried and the result is 'undefined', the reason is that you have this property

    multiselect:true
    

    in this case, the selection returns an array

    this.selection[0].index;
    

    I'd give you the first selected item, even if you only have a single element selected, for all selected items to loop through all the elements in the selection table.

    not sure if the wonderful guide Peter explains this (explained in the Guide to the tools), but you should read it too, he has tons of info.

  • DataGrid the previously selected item

    Hello

    I have a dataGrid and after change of line I need to update the previously selected line. I don't know how to catch the previously selected item (or index). On the evolution of the dataGrid event the "selectedItem" property is on the new line. I tried the 'click' event, but it is distributed after the 'change' event, so it doesn't help.

    Any ideas?

    You must save yourself.

  • Cannot select items on the page except on the specific layer

    I'm having a very strange problem in Fireworks CS5. I can't select something on my page unless I go and find the appropriate layer and select this layer. Then only, the elements of this layer will be available for selection.

    I looked through the preferences and there is no option for this market. It's terribly disturbing to my workflow. Anyone has this problem or knows how I can fix this problem?

    Thank you

    Looks like a case of simple Edit Mode.

    In the layers panel, on the far right, click the icon in the properties panel. In the list of context properties of Panel make sure you that single layer editing is switched off.

    h

  • I uninstalled ms taredo tunneling adapter by chance and now I have no access to the network or access to any windows system

    I uninstalled MS Taredo TUNNELING ADAPTER NOW I HAVE NO NETWORK or WINDOWS 7 to access anything help how can I solve this

    Hello

    Thanks for posting your query in Microsoft Community.

    You can try the following steps and check if it works for you:

    1. Click on start.
    2. Type Device Manager in the start search box, and then open it.
    3. Click the Action tab on top and click Add legacy hardware
      then click next and next again, he will then scan and find nothing then click on the screen after that.
      Wait a minute and you will see a list of devices appear, scroll and select network adapters and click Next, then in the left column choose Microsoft then in the right hand column scroll down and choose Microsoft Teredo Tunneling adapter, and then click Next and it will install it.
      To check simply do as it is set to show hidden devices right click on the Device Manager right click view, then show hidden devices.

    If the steps above does not work, you will need to download the driver from another computer on the flash drive and then install it on your computer.

    Hope the helps of information. Please get back with the results.

Maybe you are looking for

  • Drive more than 90% downloading via Bitcommet

    Hello I have a problem while downloading through BitComet, as you can see in pic 01, the drive is 99% (with BitComet 27.4 Mbps), but actually Bitcomet was download with 990 Kb/s only, which is 0.9 MB / s. You can also see pic03 and pic02, that I find

  • DesignJet T520 36in: DesignJet T520 36in printing problem

    I have a banner that I created in Adobe InDesign CS6.  File is 12.2 MB.  The file was created 36 "x 70".  When I try to print in our T520 it will print only a small part of the left area of the bottom of the picture. I tried printing from, PS, ID, Pr

  • repair Windows XP registry needed. (windows live care scanner errors found but will not fix them)

    I am running Windows XP with IE 8 and Norton 360. I do updates regularly and also use the Windows Live One Care Safety Scanner. Each Analyzer detects a problem sometimes, and fix it. The Windows tool still found some problems in my registry and fixes

  • J611 for the all-in-one Deskjet 3050 series has

    I want to download the software for my printer on my laptop. But the CD for the printer cannot download because it does not support Windows 8.1. So I thought that I can just download the software from this site, but I do not know what to use because

  • Upgrade Windows 7 OEM Windows 7 full

    I'll update my PC in the near future, and this includes the motherboard. Unfortunately, I have Windows7 OEM version so I would go to the retail (I change the motherboard to a new model.). Is it possible to upgrade my existing retail operating system?