How to use ListFieldCallback in this class... ?

Hi I have a write code to design a list box, but here I want to put an event or calling another class when you click check box. Please guide me where I need to write this code in this class.

package mypackage;

import java.util.Vector;
Import net.rim.device.api.system.Bitmap;
Import net.rim.device.api.system.Characters;
Import net.rim.device.api.system.Display;
Import net.rim.device.api.ui.Field;
Import net.rim.device.api.ui.Graphics;
Import net.rim.device.api.ui.Manager;
Import net.rim.device.api.ui.MenuItem;
Import net.rim.device.api.ui.UiApplication;
Import net.rim.device.api.ui.component.LabelField;
Import net.rim.device.api.ui.component.ListField;
Import net.rim.device.api.ui.component.ListFieldCallback;
Import net.rim.device.api.ui.component.Menu;
Import net.rim.device.api.ui.component.SeparatorField;
Import net.rim.device.api.ui.container.MainScreen;

/ public final class ListDemoScreen extends form {}

private vector _listElements;

ListField list;
private ListField _checkList;
_toggleItem private MenuItem;

public ListDemoScreen() {}
Super (Manager.NO_VERTICAL_SCROLL);
Set the displayed title of the screen
setTitle ("list Demo 1");
Add (new LabelField ("list of Fruits", LabelField.FIELD_HCENTER));
Add (new SeparatorField());

_listElements = new Vector();
Add (new SeparatorField());
list = new ListField();
ListCallback _callback = new ListCallback (this);

list.setCallback (_callback);
list.setSize (4);
int index = list.getSelectedIndex ();

Add (List);

createField();

}

protected void createField() {}
String itemOne = "Apple";
String itemTwo = "Blackberry";
String itemthree = "grape";
String itemfour = "banana";
/ * ChecklistData itemOneCheckList = new ChecklistData ("Apple", false);
ChecklistData itemTwoCheckList = new ChecklistData ("Blackberry", false);
ChecklistData itemThreeCheckList = new ChecklistData ("Grapes", false);
ChecklistData itemFourCheckList = new ChecklistData ('Banana', false);

_listElements.addElement (itemOneCheckList);
_listElements.addElement (itemTwoCheckList);
_listElements.addElement (itemThreeCheckList);
_listElements.addElement (itemFourCheckList);
reloadList(); * /

}

private void reloadList() {}
list.setSize (_listElements.size ());
}

{} public boolean invokeAction (int action)
switch (action) {}
case ACTION_INVOKE: / / Trackball click.
int index = list.getSelectedIndex ();
Data ChecklistData = _listElements.elementAt (index) (ChecklistData);
data.toggleChecked ();
_listElements.setElementAt (data, index);
List.Invalidate (index);
Returns true; We have consumed the event.
}
Return super.invokeAction (action);

}

Class ListCallback implements ListFieldCallback
{
ListDemoScreen listDemoScreen;

public ListCallback (ListDemoScreen listDemoScreen)
{
this.listDemoScreen = listDemoScreen;

}

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

ChecklistData checkListData = _listElements.elementAt (index) (ChecklistData);
String text = checkListData.getStringVal ();
g.drawText (text, 60, y + 5, 0, w);
Z.i. bitmap = null;
{if (checkListData.IsChecked ())}
BITM = Bitmap.getBitmapResource ("bullet_arrow1.png");
//          } else {
BITM = Bitmap.getBitmapResource ("bullet_arrow2.png");
//          }

w = bitm.getWidth ();
int h = bitm.getHeight ();
//
int xPos = 2;
int heightDifference = (list.getRowHeight (index) - h);
int ypos = y + (heightDifference >-1? heightDifference: 0) / 2;
//
g.drawBitmap (PosX, Posy, w, h, z.i., 0, 0);

PosX = w + 20;

CurrentRow ChecklistData = (ChecklistData) this.get (list, index);

StringBuffer rowString = new StringBuffer();

If it is checked draws the string prefixed with a ticked,
If it is not to precede a box unchecked.
If (currentRow.isChecked ()) {}
rowString.append (Characters.BALLOT_BOX_WITH_CHECK);
} else {}
rowString.append (Characters.BALLOT_BOX);
}

Add a few spaces and text on the line.
rowString.append (Characters.SPACE);
rowString.append (Characters.SPACE);
rowString.append (currentRow.getStringVal ());

Draw the text.
g.drawText (rowString.toString (), y, 0, 0, -1);

}

public Object get (ListField list, int index) {}
Return _listElements.elementAt (index);
}

public int indexOfList (String prefix, ListField list, int string) {}
Return _listElements.indexOf (prefix, string);
}

public int getPreferredWidth (ListField list) {}
Return Display.getWidth ();
}

}

private class ChecklistData
{
private String _stringVal;
Private boolean _checked;

/*
* ChecklistData() {_stringVal = ""; _checked = false;}
*/

ChecklistData (String stringVal, boolean checked) {}
_stringVal = stringVal;
_checked = enabled;
}

Get / set methods.
private String getStringVal() {}
Return _stringVal;
}

Private boolean isChecked() {}
Return _checked;
}

Toggle the verified status.
private void toggleChecked() {}
_checked =! _checked;
}

}

/*
* (non-Javadoc)
*
* @see
* net.rim.device.api.ui.container.MainScreen #makeMenu (net.rim.device.api
*. ui.component.Menu, int)
*/
protected void makeMenu (menu Menu, for example int)
{

TODO self-generating method stub
Focus on the ground = UiApplication.getUiApplication () .getActiveScreen (). getLeafFieldWithFocus();
If (focus is _checkList)
{
The ListField _checkList instance has focus.
Add the _toggleItem MenuItem.
menu. Add (_toggleItem);
}

super.makeMenu (menu, for example);
}

}

Thanks in advance

You've already got an invokeAction who knows that something has been clicked.  If you just need to add the code in there.

How to do this will depend on what kind of relationship you want to your other have with the ListField object.

You could provide a method to directly call the outer class.  Or you can use the model of the observer.  Alternatively, you can implement the FieldChangeListener - simply to call it you can just call

this.fieldChangeNotify ();

and add a field ChangeListener to the ListField.

HTH.

Tags: BlackBerry Developers

Similar Questions

  • How to use reveal all this without losing the work of culture?

    My workflow is to editing and cropping of images. I need the flexibility to perform any order.

    When I use the crop tool, I continue to delete the cropped Pixels unchecked. When I edit the images I want to edit the complete picture, not cropped image.

    If I use reveal all to make alterations on the full image after cropping, I lose my job of cropping. Is there a solution?

    How to use reveal all this without losing the work of culture?

    How to take a bath without getting wet?

    Enter drollery side you could use a path of access to store the current size before calling "Reveal everything", then later on the path as a selection of load, switch to the crop tool and hit.

    Or convert to smart object before you crop, then do the editing in the SO (it could be a potentially significant increase in file size, however).

  • How to use the RMI Stub class in programming?

    Hi all

    I'm new to the RMI.

    Can someone explain to me how to use the RMI Stub generated by calling command CRIM?
    For my tests, I can only call object rmi through its remote interface method. So what heel is when we are coding?

    I appreciate anyone's help.

    Thank you very much
    Xianyi.Ye

    When the remote object is committed to the registry, which is actually linked is the draft.

    So when the client performs a search in the registry, as it gets is the heel. However from the point of view of the customer, it's just a mystery object that implements the remote interface.

    So you must use it directly, it's all automatic.

  • Is there a tutorial how to use certificates to protect a PDF of sharing/opening/printing it?

    I want to share a PDF file that should not be shared with others and can only be opened on a specific computer. No idea how to use certificates for this. Or are there other ways to do it?

    Thank you

    You can consult the help:

    Acrobat help. Securing PDF files with certificates

  • How to use this class

    The following code is a class I want to use (Arc.as), but it doesn't have a constructor function (i.e. public void Arc()). How to use this class in Flex? I also placed the code I thought I could use.

    Yes, in the example of the arc, in the change of loop(e:Event):
    removeChild (sp);
    TO:
    container.removeChild (sp);

  • Is there an online class to learn exactly how to use the command prompt which is quite through. OR y at - it clear a book that explains in detail for this? Who should I contact?

    I would like to know how to use the command prompt.  The nethodology type in the cmd prompt with the syntax and the Liposuction, in other words, the real return to a command prompt. I downloaded about evertthing I can find about this, but can't seem to put it all.

    My OS is Windows XP Pro sp3, lots of RAM, my address is * address email is removed from the privacy *.   I would like to take a rough online study if one is available if it is not too expensive.

    It really depends on what you mean by "to a command prompt."

    If you open a command prompt window (for example, in start > run > cmd > OK), you can enter a number of orders.  The list of available commands, including their syntax, is here--> http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true

    You can also follow the links here:http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_o.mspx

    If you want to get more sophisticated - automating command-line tasks - you can start here: http://technet.microsoft.com/en-us/scriptcenter/default.aspx

  • How to use outside of class in the packed library plugins

    I found the article very useful to Michael Lacasse (https://decibel.ni.com/content/docs/DOC-19176) how to use the library packaged as plugins. This approach makes the most sense when you try to distribute additional code after that your executable is already installed.

    My problem is that when I try to use a class from the main code in a plugin, plugins no longer works. Ideally, I would have liked the parent plugin interface to inherit from a class that is used in the main code, either by using the class as parameter of the plugin would be the next best thing.

    I had several mistakes, some runtime (#1448) or at the time of publishing ("VI it does not match other screws in the method: connector side terminal (s)"). I set to use clusters to transfer data to the plugins.

    My question is: is it possible to use a class defined in the main code in a packed-project-library, either inherited or as a parameter? If Yes, do you have any examples?

    It is not made with real CLASS structures, but I do the same with PPLs.

    Don't try to inherit from something in the MAIN host.

    Create the ancestor class in a separate PPL.

    Use it for the most PART, as it is.

    Inherit it in your modules.

  • I bought a Macbook used, and now I can't update iMovie, iPhoto and iTunes without apple ID of the older owner how can I work around this?

    Hey everybody,

    This is my first post. A couple of years, I bought a used Macbook. I never did update (it is so long and then I decide to Watch youtube videos... it is not used for work or school). So now, I've updated the Yosemite and I want to get everything updated and it requires that I put a password of the former owner apple ID to update iTunes, iPhoto and iMovie. How can I get around this without reformatting and losing thousands of photos and all my files.

    Thank you guys.

    If you are the legal owner of the computer, but if the software you want is owned by another user is not yours. You cannot add any other purchases to your ID. You own, or that they are.

    backup with time machine

    move all your data in the folder user to an external drive or a flash drive is formatted in a format not mac or by checking the box "ignore this volume permissions" in get info of this device.

    do a clean install of the operating system

    create a new administrative account

    the Time Machine restore requests

    transfer your data from external sites back to the new account.

  • whenever I type in the google box to search for each letter i firefox type which application I would like to use to open this file, this is so embarrassing, how to stop this?

    whenever I type in the google box to search for each letter i firefox type which application I would like to use to open this file, this is so embarrassing, how to stop this?

    You are welcome

    Can you tell us which extension caused your problem?

  • How to use the stock firmware to fix your Tablet this stock in recovery mode

    Help plssss...

    Where I can download stock firmware for my Hp Slate 7 HD 3403ex and how to use it.

    Hi there @rangothegreat

    Welcome to the Forums of HP Support! It's a good place to find the help you need, so many other users, the HP experts and other members of the support staff. I understand that you are looking for a firmware image for your tablet. I'm happy to help you.

    The support page for your model contains images of catering for Android Jelly Bean and can be found here:

    7 HD 3403ex Tablet Slate from HP

    If you have already installed a newer version of Android like KitKat, these images will not work for you. See the post following @WyreNut referring to this possible problem.

    4.4.2 android update failed for the HP Slate 10 HD

    If this applies to you, then please use the following http://www.hp.com/contacthp and create a folder for your question and contact HP. If you do not live in the United States / Canada, please click on the link below to get contact information for your region.
    http://WWW8.HP.com/us/en/contact-HP/WW-phone-assist.html

    I hope this helps.

  • There is, WindowsXP had a battery drain fix (patch). How can I determine if this hotfix is installed on my laptop? I have not used a battery for years but want to order determined

    There, Windows XP had a battery drain fix (patch). How can I determine if this hotfix is installed on my laptop? I haven't used a battery for years, but I would like to order a.

    If the hotfix is not installed, how can I get it to install?

    Your question is too vague.  Most of the life themes battery by Windows XP tasks occur only in some computers - and yours may or may not benefit from all the suggested fixes.  In addition, some of these plots have been released a long time ago and were likely incorporated into a later Service Pack.  You should have installed Service Pack 3 for Windows XP 5 years.

    If you want to use your laptop as a portable device, I suggest you buy a battery - not the cheapest possible one - and use it for a while.  If you experience shorter than the normal battery life, you can ask for help then or read through the results of this research--> http://support.microsoft.com/search/default.aspx?query=battery+life+xp&x=4&y=8&mode=a&spid=global&catalog=LCID%3D1033&wa=wsignin1.0

  • What is VISA % 3F components how to use this % 3F

    Hi all

    I'm a beginner for labview, so I want to know clearly about the VISA components and how to use it? Please help me learn LabVIEW

    Thank you in advance,

    Check this post. There is also an attached document (pdf), which is the introduction of VISA. After going through it, you can ask questions of the special about VISA.

  • I use Windows XP Home Edition. It takes awhile to start when I turn on the computer. How can I speed up this process?

    I use windows XP Home Edition. It takes awhile to start when I turn on the computer. How can I speed up this process?

    original title: slow start
    • Faster processor.
    • Fastest hard drive.
    • Faster or more RAM/memory.
    • Less things loading at startup.
    • Appropriate and the most recent hardware device drivers.

    In XP, you can cleanup and optimize it in some way, by using the following tips:

    Search for malware:

    Download, install, execute, update and perform analyses complete system with the two following applications:

    Remove anything they find.  Reboot when necessary.  (You can uninstall one or both when finished.)

    Search online with eSet Online Scanner.

    The less you have to run all the time, most things you want to run will perform:

    Use Autoruns to understand this all starts when your computer's / when you log in.  Look for whatever it is you do not know using Google (or ask here.)  You can hopefully figure out if there are things from when your computer does (or connect) you don't not need and then configure them (through their own built-in mechanisms is the preferred method) so they do not - start using your resources without reason.

    You can download and use Process Explorer to see exactly what is taking your time processor/CPU and memory.  This can help you to identify applications that you might want to consider alternatives for and get rid of all together.

    Do a house cleaning and the dust of this hard drive:

    You can free up disk space (will also help get rid of the things that you do not use) through the following steps:

    Windows XP should take between 4.5 and 9 GB * with * an Office suite, editing Photo software, alternative Internet browser (s), various Internet plugins and a host of other things installed.

    If you are comfortable with the stability of your system, you can delete the uninstall of patches which has installed Windows XP...
    http://www3.TELUS.NET/dandemar/spack.htm
    (Especially of interest here - #4)
    (Variant: http://www.dougknox.com/xp/utils/xp_hotfix_backup.htm )

    You can run disk - integrated into Windows XP - cleanup to erase everything except your last restore point and yet more 'free '... files cleaning

    How to use disk cleanup
    http://support.Microsoft.com/kb/310312

    You can disable hibernation if it is enabled and you do not...

    When you Hibernate your computer, Windows saves the contents of the system memory in the hiberfil.sys file. As a result, the size of the hiberfil.sys file will always be equal to the amount of physical memory in your system. If you don't use the Hibernate feature and want to reclaim the space used by Windows for the hiberfil.sys file, perform the following steps:

    -Start the Control Panel Power Options applet (go to start, settings, Control Panel, and then click Power Options).
    -Select the Hibernate tab, uncheck "Activate the hibernation", and then click OK. Although you might think otherwise, selecting never under "Hibernate" option on the power management tab does not delete the hiberfil.sys file.
    -Windows remove the "Hibernate" option on the power management tab and delete the hiberfil.sys file.

    You can control the amount of space your system restore can use...

    1. Click Start, right click my computer and then click Properties.
    2. click on the System Restore tab.
    3. highlight one of your readers (or C: If you only) and click on the button "settings".
    4 change the percentage of disk space you want to allow... I suggest moving the slider until you have about 1 GB (1024 MB or close to that...)
    5. click on OK. Then click OK again.

    You can control the amount of space used may or may not temporary Internet files...

    Empty the temporary Internet files and reduce the size, that it stores a size between 64 MB and 128 MB...

    -Open a copy of Microsoft Internet Explorer.
    -Select TOOLS - Internet Options.
    -On the general tab in the section 'Temporary Internet files', follow these steps:
    -Click on 'Delete the Cookies' (click OK)
    -Click on "Settings" and change the "amount of disk space to use: ' something between 64 MB and 128 MB. (There may be many more now.)
    -Click OK.
    -Click on 'Delete files', then select "Delete all offline content" (the box), and then click OK. (If you had a LOT, it can take 2 to 10 minutes or more).
    -Once it's done, click OK, close Internet Explorer, open Internet Explorer.

    You can use an application that scans your system for the log files and temporary files and use it to get rid of those who:

    CCleaner (free!)
    http://www.CCleaner.com/
    (just disk cleanup - do not play with the part of the registry for the moment)

    Other ways to free up space...

    SequoiaView
    http://www.win.Tue.nl/SequoiaView/

    JDiskReport
    http://www.jgoodies.com/freeware/JDiskReport/index.html

    Those who can help you discover visually where all space is used.  Then, you can determine what to do.

    After that - you want to check any physical errors and fix everything for efficient access"

    CHKDSK
    How to scan your disks for errors* will take time and a reboot.

    Defragment
    How to defragment your hard drives* will take time

    Cleaning the components of update on your Windows XP computer

    While probably not 100% necessary-, it is probably a good idea at this time to ensure that you continue to get the updates you need.  This will help you ensure that your system update is ready to do it for you.

    Download and run the MSRT tool manually:
    http://www.Microsoft.com/security/malwareremove/default.mspx
    (Ignore the details and download the tool to download and save to your desktop, run it.)

    Reset.

    Download/install the latest program Windows installation (for your operating system):
    (Windows XP 32-bit: WindowsXP-KB942288-v3 - x 86 .exe )
    (Download and save it to your desktop, run it.)

    Reset.

    and...

    Download the latest version of Windows Update (x 86) agent here:
    http://go.Microsoft.com/fwlink/?LinkId=91237
    ... and save it to the root of your C:\ drive. After you register on the root of the C:\ drive, follow these steps:

    Close all Internet Explorer Windows and other applications.

    AutoScan--> RUN and type:
    %SystemDrive%\windowsupdateagent30-x86.exe /WUFORCE
    --> Click OK.

    (If asked, select 'Run'). --> Click on NEXT--> select 'I agree' and click NEXT--> where he completed the installation, click "Finish"...

    Reset.

    Now reset your Windows with this FixIt components update (you * NOT * use the aggressive version):
    How to reset the Windows Update components?

    Reset.

    Now that your system is generally free of malicious software (assuming you have an AntiVirus application), you've cleaned the "additional applications" that could be running and picking up your precious memory and the processor, you have authorized out of valuable and makes disk space as there are no problems with the drive itself and your Windows Update components are up-to-date and should work fine - there is another thing you pouvez wish to make:

    Get and install the hardware device last drivers for your system hardware/system manufacturers support and/or download web site.

    If you want, come back and let us know a bit more information on your system - particularly the brand / model of the system, you have - and maybe someone here can guide you to the place s x of law to this end.  This isn't 100% necessary - but I'd be willing to bet that you would gain some performance and features in making this part.

  • When I try to scan with my CanoScan N640P ex scanner I receive a message indicating the Port to the printer that is used by another device. How can I work around this problem?

    When I try to scan with my CanoScan N640P ex scanner I receive a message indicating the Port to the printer that is used by another device.  How can I work around this problem?

    Hi ejp70,

    1. did you of recent changes on the computer?

    2. to when was the last time the scanner was working fine?

    3. you have any other printer\scanner connected to the computer?

    If you have any other printer\scanner connected to the computer, disconnect them and check if it works.

    I suggest that you uninstall and reinstall the scanner to the computer, also make sure that you install the latest drivers for scanner on Canon website.

  • Each time I click on a folder, search companion will appear. I am interested in DISABLING research or travel companion down on the pop-up menu, or at least, put it further down in the context menu. How can I do this? My computer not used to do this.

    Each time I click on a folder, search companion will appear. I am interested in DISABLING research or travel companion down on the pop-up menu, or at least, put it further down in the context menu. How can I do this? My computer not used to do this.

    Doug Knox fix - http://www.dougknox.com/xp/scripts_desc/xp_folder_open.htm
    Search Companion starts if you double-click a folder or computer drive - http://windowsxp.mvps.org/searchwindow.htm MS - MVP - Elephant Boy - Don ' t Panic!

Maybe you are looking for

  • Samsung SSD upgrade problems

    When I try to erase the SSD drive and format it for Mac the procedure fails: I get: dismount disc, cannot write to the last block of the unit, failed... I have a MBP end 2011 with El Captan freshly installed and the SSD is Samsung 850 Pro 512 GB.

  • Start Skype without that he may stop responding

    Whenever I start my Skype, it stops responding and makes me close. Log of Windows Event Viewer: Name of the failing application: Skype.exe, version: 6.21.59.104, time stamp: 0x542bf5dbThe failed module name: mshtml.dll, version: 11.0.9600.17344, time

  • Windows Defender has stopped working properly

    When I turn on my laptop it user interface say that windows defender has stopped working properly, can not open windows defender to look at settings etc and since it has stopped working the computer guard stopping self to protect self, someone at - i

  • Forgotten password Win7

    I did a system restore to a certain point and must have changed my password since then, and of course I don't remember. I do not have a disk and there is no guest account or admin. I don't want to lose my data by performing a restart of the computer,

  • Start menu search not shown any results

    Whenever I search something in the start menu, nothing happens. No file. No request. Nothing, and if I click on "See more results", it gives me this error "windows cannot access the specified device path or file. you don't have appropriate permission