FieldChangeListener for the custom field does not...

Hi all

I searched for him and almost all positions tried but failed to get the solution of it. Here is my code. My problem is when I click on the individual images the fieldchangelistener must be called and the message.

package com.samples;

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;

public class CustomPaintingScreen extends MainScreen implements FieldChangeListener
{
    CustomClass[] custom;

    FieldChangeListener itemlistener = new FieldChangeListener() {

        public void fieldChanged(Field field, int context)
        {
            Dialog.alert("clicked");
        }
    };

    public CustomPaintingScreen()
    {
        setTitle("Custom Painting ");
        custom = new CustomClass[10];
        VerticalFieldManager vfm = new VerticalFieldManager(Manager.VERTICAL_SCROLLBAR|Manager.LEAVE_BLANK_SPACE);  

        for (int i = 0; i < custom.length; i++)
        {
            custom[i] = new CustomClass();
            custom[i].setChangeListener(itemlistener);
            vfm.add(custom[i]);
        }
        this.add(vfm);
    }

    public void fieldChanged(Field field, int context)
    {
        if(field instanceof CustomClass)
        {
            Dialog.alert("clicked");
        }
    }
}

and here's my customclass

package com.samples;

import java.util.Vector;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.system.Display;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Font;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.XYRect;

public class CustomClass extends Field //implements FieldChangeListener
{
    private XYRect dest;
    private Bitmap bitmap;
    private Vector vtr;
    private Bitmap next;

    public CustomClass()
    {
        bitmap = Bitmap.getBitmapResource("laptop.png");
        next = Bitmap.getBitmapResource("next.png");
        dest = new XYRect(20,15,bitmap.getWidth(),bitmap.getHeight());
        //this.setChangeListener(this);     

        vtr = new Vector();
    }

    protected void layout(int width, int height)
    {
        height = getFont().getHeight()* 5;
        setExtent(Display.getWidth(), height);
    }

    protected void paint(Graphics graphics)
    {
        graphics.setColor(0xFF7F24);
        graphics.fillRoundRect(5, 5, (getWidth()-10), (getFont().getHeight()*5), 30, 40);
        graphics.drawBitmap(dest, bitmap, 0, 0);
        graphics.setColor(Color.BLACK);
        int x = bitmap.getWidth()+25;
        int y = 15;
        graphics.setFont(getFont().derive(Font.BOLD));
        graphics.drawText("Dell Laptop", x, y, 0, getWidth());
        graphics.setFont(getFont().derive(Font.PLAIN,15));

        String str= "Discover Dell Inspiron and XPS Laptops with advanced technology.this is dell laptop";
        vtr = wrap(str, 300,graphics);
        System.out.println(" "+vtr.toString());

        graphics.drawBitmap(335, 15, next.getWidth(), next.getHeight(), next, 0, 0);

//      graphics.drawText(vtr.toString(), x, (y+20), 0,300 );
    }

    private Vector wrap (String text, int width,Graphics graphics)
    {
        int x = bitmap.getWidth()+25;
        int y = 35;

        Vector result = new Vector ();
        if (text == null)
           return result;

        boolean hasMore = true;

        // The current index of the cursor
        int current = 0;

        // The next line break index
        int lineBreak = -1;

        // The space after line break
        int nextSpace = -1;

        while (hasMore)
        {
           //Find the line break
           while (true)
           {
               lineBreak = nextSpace;
               if (lineBreak == text.length() - 1)
               {
                   // We have reached the last line
                   hasMore = false;
                   break;
               }
               else
               {
                   nextSpace = text.indexOf(' ', lineBreak+1);
                   if (nextSpace == -1)
                      nextSpace = text.length() -1;
                   int linewidth = this.getFont().getAdvance(text,current, nextSpace-current);
                   // If too long, break out of the find loop
                   if (linewidth > width)
                      break;
               }
          }
          String line = text.substring(current, lineBreak + 1);

          graphics.drawText(line, x, y, 0,350 );
          y=y+15;

          result.addElement(line);
          result.addElement(new String("\n"));
          current = lineBreak + 1;
     }
     return result;
    }

    protected boolean navigationClick(int status, int time)
    {
        fieldChangeNotify(1);
        return super.navigationClick(status, time);
    }

    protected void fieldChangeNotify(int context)
    {
        super.fieldChangeNotify(context);
    }
}

also my images look like this

When I click on the individual images, the dialog box should appear. I tried a lot of things. give me a code. for screen touch for example jde4.7 and jde4.5

Hi peter - what did I want to add the listener on the image above and manipulate. and the picture above, I created using the graphics object. so this is the question that I am able to get the listener?

Tags: BlackBerry Developers

Similar Questions

  • How long does it take for the custom field created in SFDC appears in the list of field mapping?

    How long does it take for the custom field created in SFDC appears in the list of field mapping? I hit the refresh field button, but it does not appear after 5 min. I just need to have patience?

    I had the same problem yesterday, I think it took about 10-15 minutes to appear.

  • Windows 2008 Server: unable to update the password. the value provided for the new password does not respect length, complexity, or history of the field requirements

    Unable to update the password. the value provided for the new password does not respect length, complexity, or history of the field requirements

    Hello

    I suggest you to send your request in this forum for better support.
  • the custom words does not appear in my iPhone

    Hello

    I joined my iPhone IOS 10 6 more and I noticed that the custom words does not appear in my iPhone, even if I have them in my iTunes library. I signed up with the same Apple ID on all devices. Very few of them, I can access the lyrics in my phone, but not all of them (as he used to be in iOS 9)

    any help is appreciated.

    Thank you

    Ahmed

    I downloaded a program on my Mac (no app store unfortunately) called "get lyrical". automatically add lyrics to iTunes. Then in iTunes file > library > Update music library to iCloud. doing this during the last 20 minutes and so far it seems to work.

  • HP - 15 af008ax: my new laptop usb port for the left side does not, only 1 work on 3 Please help me

    My new laptop usb port for the left side does not, only 1 work on 3 Please help me

    Hello:

    Have you installed the drivers for W7 32 bit amd chipset?

    If this isn't the case, you must install them and reboot the PC to get the 3 for usb ports work.

    You want the first file on the Web page.

    http://support.AMD.com/en-us/download/chipset?OS=Windows%207%20-%2032

  • Why lightroom 5.7.1 patch for the dvd version does not support the Elimination of fog and the internet the trial version only?

    Why lightroom 5.7.1 patch for the dvd version does not support the Elimination of fog and the internet the trial version only?

    I have the dvd of my camera samsung nx3000 and got version and upgrade to 5.7.1 (high-end) and it is not the removal of the trial version of lightroom download creative cloud fog. How to get this tool software mi?

    Hi nicoa,.

    Dehaze feature has been introduced in the version of Lightroom CC2015.1 and is not a part of 5.7.1 version which is the previous version.

    If you need the dehaze feature, you must subscribe to plan creative cloud so that you use the latest version of Lightroom.

    Kind regards

    Claes

  • my toolbar (for the PDF edition) does not appear in a newly opened PDF file. What is the problem?

    my toolbar (for the PDF edition) does not appear in a newly opened PDF file. What is the problem?

    Hi Joanne,

    If you are unable to display the toolbar by choosing View > show/hide > elements elements toolbar, please send along a screenshot of what you see. (And just double check that you open your PDF files in Acrobat and not player - that is a mistake that I make here and there).

    Best,

    Sara

  • Question regarding setExtent and getPreferredWidth for the custom field

    I am trying to understand the difference between getPreferredWidth and setExtent, which relate to the width of a custom field.

    I create a field that may be greater than the width of the screen. The field is made up of cells (for example columns and lines or cells, such as a table). The cells contain text, shapes, lines, color, etc. When I display the field I only paint the visible columns on the screen and allow the user to use the trackball to accomplish the columns out of the screen.

    At present, getPreferredWidth returns the total width of the field without all the empty columns, is longer than the width of the screen. I use the same value in setExtent for width. GetPreferredWidth must return the size of the field that is painted on the screen - the total width less the width of the columns out of the screen? I have the same question about setExtent - width either in total, longer than the screen width or the width of the part of the field that is painted on the screen?

    If I use the width of what is painted on the screen or the other of these methods, then the width changes when the user scrolls through the field. As the user scrolls, I calculate the number of columns will agree to a width of the screen and paint these columns. Is it a problem to have the PreferredWidth and the setExtent change width? I read that setExtent is called only when the Manager sets this field, so that the changes will not be recognized.

    It seems to work in two ways in a few simple tests, but I was just curious as the value of width that is right.

    Thank you!

    Mark

    When a field has changed in a way that requires the update of the screen (for example, after scrolling offset changes), simply call invalidate() from this area. That will eventually lead to paint (Graphics) for the field. At this point, you return the update field. (If only part of a field - as a single cell - needs to be updated, there invalidate() versions that accept arguments where, for efficiency, you can limit the update for just this part.)

    If I understand your needs, you can achieve the effect desired in the paint method. You can use the current dimensions of the field, the cutting of the graphics area, and your internal roll compensates to decide what to paint and what to delete. Let your custom field leave white space where you decide of doesn't make is not part of a cell. There is no need to change the scope of the field.

    If you go about it by changing the dimensions of the field, and then you ask the system to play much more work he has to do. If the custom field is the only field on the screen, it won't make much difference in the behavior (although there may be performance). With more than one field, it can be weird effects. For example, suppose that your custom field is one of several fields in a HorizontalFieldManager and you change the field width. When the HorizontalFieldManager recalculates its own layout, it will change the horizontal position of the fields to the right. The effect on the user, I think, would be really confusing: as the custom field parade, parties to the right of the screen could bounce left and right as the changed width field. I can't imagine that's what you want.

    Here's another way to think about this: absent some bit of style, your custom field would prefer be exactly wide and high enough to show all without scrolling. So the width and height would be based on adding the appropriate cell widths and heights, regardless of what actually is on the display. (It's also a long time that you do not have something fanciful.) If the optimum height is a function of the width available - as with sheathed on the line of text - you would implement this logic in the layout method. You then have no use for autonomous preferred width and height).

  • Satellite A100-499 - function for the WiFi button does not work

    Hello, I have a Toshiba Satellite A100 - 499 PSAA9E.

    I formatted my laptop and installed XP with SP3. I downloaded and installed the drivers (in the right order) for this OS of the toshiba - Europe.com and everything is going well except Fn + F8. It is assumed that this combination has toggle Wifi & Bluetooth. When I switch side 'off' position and I press the keys, appears a message saying that I should switch to position 'on' but when I switch lateral position 'on' and I press Fn + F8 it does nothing.

    If I want to disable the wi - fi I have to do it with other methods: the function key does not work correctly.

    Any clue?
    Thanks for the advice (and sorry for my English).

    When the WLAN switch is on orange LED is also on?
    You can scan area available networks?
    Have you tried to use the WLAN without using FN + F8?

  • Dynamic CRM2011 for the outlook client does not recognize that I have already installed SP2

    Dynamic CRM2011 for server (vista 64-bit) or the outlook client does not recognize that I have already installed SP2

    Error log (edited to highlight what appears to be the problem):
    Latest Version of the OS: 6.0.6001
    11:14:06 |   Info |   Service Pack: Service Pack 1
    11:14:06 |   Info |   System type: workstation
    11:14:06 |   Info |   Mask away: 0 x 0300
    11:14:06 |  Error | Failed to install Microsoft Dynamics CRM for Outlook. Install Windows Vista Service Pack 2 and then try again.
    11:14:06 |  Error | System requirements not filled to allow the installer to run.
    My computer works SP2 and all current updates except for:
    • Platform Update for Windows Vista x 64-based Systems (KB971644)
    1. error: 8000ffff
    I ran 'fit' the Microsoft tool, but made no difference. This update is my problem, or I am barking the wrong tree?
    Help, please!

    Hi Paul,.

    The question you posted would be better suited in the Forums of Microsoft Dynamics. I would recommend posting your query in the Forums of Microsoft Dynamics.

    http://social.Microsoft.com/forums/en-us/category/Dynamics

  • Gets the error in Windows Denfender for "the specified service does not exist as an installed device (error Code: 0 x 80070424).

    My computer was slow, so I tried to scan all using Windows Defender, and this error message keeps popping up, "the specified service does not exist as an installed device (error Code: 0 x 80070424) I don't know how fx this.» I' of love too see if there is another reliable computer, free softwear that can scan and virus scanning spywear.

    Hello

    Windows Defender is an antispyware software, not an Antivirus.

    If you use Norton, AVG, Avira, Microsoft Security Essentials, McAfee, etc. the default action is for Windows Defender must be disabled, that these AntiVirus programs have their own Antispyware Applications.

    There is nothing to worry.

    Using both programs at the same time can cause system conflicts, etc.

    If you are using one of the above AntiVirus programs, this Information from David O - Support Engineer shows you how to manually enable Windows Defender (disregard information from uninstalling; not possible in Vista):

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-security/how-do-i-manually-start-Windows-Defender-in-Vista/dab845b2-9ba5-47F3-9518-c4c6781e7d5b

    "Go to start, Control Panel, Administrative Tools, Services. Look for Windows Defender.

    Right click and select Properties , ensure that Startup Type is automatic.

    Once modified, click apply and OK.

    Quit and restart your computer. Check the back take the same path to confirm that Windows Defender has started"

    .

    And for now, change startup Vista programs without using Defender, use one of these methods:

    "How to use MSCONFIG in Windows Vista"

    http://netsquirrel.com/Msconfig/msconfig_vista.html

    Or the program Autoruns for FREE:

    "V11.21 Autoruns for Windows"

    http://TechNet.Microsoft.com/en-us/sysinternals/bb963902

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

    And try this method for the analysis of Malware

    Scan of Malware in Safe Mode with network.

    http://www.bleepingcomputer.com/tutorials/how-to-start-Windows-in-safe-mode/#Vista

    Windows Vista

    Using the F8 method:

    1. Restart your computer.
    2. When the computer starts, you will see your computer hardware are listed. When you see this information begins to tap the F8 key repeatedly until you are presented with the Boot Options Advanced Windows Vista.
    3. Select the Safe Mode with networking with the arrow keys.
    4. Then press enter on your keyboard to start mode without failure of Vista.
    5. To start Windows, you'll be a typical logon screen. Connect to your computer and Vista goes into safe mode.
    6. Do whatever tasks you need and when you are done, reboot to return to normal mode.

    Once in Safe Mode with network, download and run RKill.

    RKill does NOT remove the malware; It stops the Malware process that gives you a chance to remove it with your security programs.

    http://www.bleepingcomputer.com/download/rkill/

    Then, download, install, update and scan your system with the free version of Malwarebytes AntiMalware in Mode safe mode with networking:

    http://www.Malwarebytes.org/products/malwarebytes_free

    See you soon.

  • HP LaserJet 1018: For the printing window does not appear

    This problem started recently.  When I try to print on both sides, print the first side, then the little window that used to appear with instructions to remove and re - insert the page for printing of the second part does not appear.   This means that there is no "continue" button click on because it's in the same window.  So I can not print the second side.

    Any suggestions on what is wrong and how to fix it?

    Hi @msdop ,

    I see that you have problems printing manual duplex, the window is not to come to continue to print across the page. I will definitely do my best to help you.

    There are a couple different things you can try to solve this problem.

    Restore your computer to an earlier time when everything worked correctly. He could be an update that caused this problem.  Restore the system for Windows 7

    Download and run the Print and Scan doctor. It will diagnose the problem and could solve it automatically. Find and fix common printer problems using the tools of diagnosis HP for Windows?

    Uninstall and reinstall the printer software.

    Uninstalling the printer software.

    Windows 7 64 bit drivers: HP LaserJet full feature software and driver.

    Windows 7 32 bit drivers: HP LaserJet full feature software and driver.

    If you need help, let me know.

    Have a great day!
    Thank you.

  • Entry of the appellant for the call manager does not to the first entry, books on the second

    Unity 4.0 (4) SR1, 7.0 (4) flat TSP

    Have a call handler when option 4 as input, the appellant and the user calls into customer and they get the welcome message, but when they hit 4 it does not first time. Replays of greeting and they hit 4 again and it works fine. 4 is set to go Manager directory. 4 is a key blocked under the entry for the appellant. This happens whenever they call and get the salvation of the unit.

    They have 2 extensions 4xxx configured on the system also.

    The unit probably behaves correctly. To confirm that the unit made, turn on the microphone traces PhraseServertoMonitor and watch the appeal on PortStatusMonitor.

  • Send &amp; track to an email recipient, SPACEBAR in the topic and the content fields does not.

    After the last update Acrobat, when using send & track to an e-mail recipient, I am unable to use the SPACEBAR in the subject and the content fields. Acrobat is also unstable, having fallen a few times during editing documents, specifically trying to save these changes.

    I restarted my computer desk Win7 twice and it seems to make little difference.

    Hi Mark,

    Today we released a hotfix that resolves this problem on space/line jump does not work in the transmission and the railway. If you're not already updated to the latest patch, simply open Acrobat and visit help > check for updates to apply this hotfix.

    More details about this release and bug fixes is available here: https://helpx.adobe.com/acrobat/release-note/acrobat-dc-june-02-2016.html

    Please give it a try and let us know.

    Thank you

    -ashu

  • deploy from model with the custom form does not not - NIC becomes disconnected

    [We're using vcenter 5.1 update 2]

    I have created a new model for 2012 Server R2 and I created a specification tailored to go with it. I went to test the deployment of the other day and it seemed that the personalised has not quite finished. He had put the local administrator password and baptized, but he does not join the domain. I finally understood that after the deployment, the NETWORK adapter is not connected despite having me 'connect to light' checked in the model. We are using the VMXNET 3 card.

    I've been messing around with the template for the past 2 days and I am stuck as to why it does not work. I tried the following...

    -checked the windows firewall is disabled (3 options) (Re: ESXi 5 VM / Server 2008 R2 loses the network connection after reboot)

    -removed NIC; cleaned up the registry to the HKLM\System\CurrentControlSet\Control\Network\; restarted; readded NIC (it was to eliminate any ghost NICs) (http://vnetwise.wordpress.com/2012/06/09/vmware-template-deploymentspart-1-trying-to-modify/)

    -Remove vmware tools and reinstall. (http://vnetwise.wordpress.com/2012/06/09/vmware-template-deploymentspart-1-trying-to-modify/)

    -card network in the operating system, unchecked "allow the computer to turn off to save energy" (Re: ESXi 5 VM / Server 2008 R2 loses the network connection after reboot)

    -checked that my new 2012R2 model uses the same host cluster and storage as my 2012 model that works. Also on the same port group distributed. (Essentially, all parameters of vcenter are identical between the two models)

    -also tried disabling the NETWORK card in the model (Windows Server 2012 comments customization)

    I have re-deployed the same server about 10 times and each time after deployment, you can see restart and try starting the customization but it crashes. If I manually turn the NIC on it is completed successfully. The problem is that I don't want to have to do that each time I deploy a server. Why is it disable the NIC and unchecking my option to connect to turn on and how to fix this?

    6.23.2014

    Based on tests (as detailed below):

    5.1 U2 - when patterns of deployment Server R2 2012 using a custom form, the NIC is not on after the deployment despite having ' connect at power on "checked.

    * We use VMXNET 3 and we use vDS


    Any help is very appreciated!

    -Adam

    Post edited by: atom_acres

    Problem solved: you need to update the hardware VM version from 8 to 9 on the template (also be sure to check "running on check and put vmtools")

    When you create a new virtual machine from scratch in 5.1 U2, he apparently uses VM Hardware version 8 instead of the latest v9. Once I upgraded it, made sure to check the box to have check and tools upgrade vm market, deploying with customization works and the NETWORK adapter is enabled when lit!

Maybe you are looking for