Problem of custom field

I am creating a custom like this field...

 class TextBoxField extends FlowFieldManager {

    //Pass in the fixed height and width for our object
    public TextBoxField() {

        super(Manager.NO_VERTICAL_SCROLL);

        add(new BasicEditField(null, "00", 2, BasicEditField.FILTER_INTEGER) {
        public int getPreferredWidth() {
            return this.getFont().getAdvance("00");
        }
        protected void layout(int width, int height)  {
            super.layout(getPreferredWidth(), height);
        }
        });
        add(new BasicEditField(null, " ", 1, BasicEditField.NON_FOCUSABLE) {
        public int getPreferredWidth() {
            return this.getFont().getAdvance(" ");
        }
        protected void layout(int width, int height)  {
            super.layout(getPreferredWidth(), height);
        }
        });
        add(new BasicEditField(null, "00", 2, BasicEditField.FILTER_INTEGER) {
        public int getPreferredWidth() {
            return this.getFont().getAdvance("00");
        }
        protected void layout(int width, int height)  {
            super.layout(getPreferredWidth(), height);
        }
        });                

    }

    public String getText() {
        return "something";
    }

    public void setText(String text) {

    }
}

I use flowfiledmanager so that when the No. field is more fields will come automatically to the next line... but what is happening is less without field its works ok... with none of the fields the field go to the next line too... but the size of the screen, the field is added at reduced... images will make you understand what happening exactly... could you please tell me what is happening... who can I fix this... or may be another way I might have several fields edit base side by side...

Finally able to get it to work... I had to substitute the as well the method of getPrefferedHeight

public int getPreferredHeight() {}
          
Return this.getHeight ();
}

then I had problems with the update... the focus was lost when a window is opened in the background... .i could solve this bye of the problem of the substitution of the field paint method...

{} public void paint (Graphics g)
getManager () .invalidate ();
Super.Paint (g);
}

Hope this helps someone...

Tags: BlackBerry Developers

Similar Questions

  • Changing custom field problem Listener

    I created a custom field that works as a button. He painted a bitmap to the screen. And when it focuses it changes the color of the image. However, I try to add a field change listener to it. I looked on the forum and found this code.

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

    It works but I have a problem. You see, my button now push a small screen, thin in the stack that has another button of the same type on it (custom button). At the moment it is the only button on this screen, which means that it has the focus. But it seems that once my button has the focus, I can click anywhere and it is always enabled. I only want to be activated when I touch it. Any suggestions? Here is my code

    public class MenuButtonField extends Field
    {
        Bitmap imagePic;
        Bitmap highlightedPic;
        public MenuButtonField(String imageName, String focusedImg)
        {
            super();
            imagePic=Bitmap.getBitmapResource(imageName);
            highlightedPic=Bitmap.getBitmapResource(focusedImg);
        }
    
        public void layout(int width,int height)
        {
            setExtent(20,80);
        }
    
        public boolean isFocusable()
        {
            return true;
        }
    
        public void drawFocus(Graphics graphics, boolean on)
        {
            paint(graphics);
        }
    
        public boolean touchEvent(TouchEvent message)
        {
            int type=0;
            type=message.getEvent();
            if(type==TouchEvent.CLICK)
            {
                fieldChangeNotify(1);
                return true;
            }
            else{
                return false;
            }
        }
    
        protected boolean navigationClick(int status, int time) {
            fieldChangeNotify(1);
            return super.navigationClick(status, time);
        }
    
        protected void paint(Graphics g)
        {
    
            g.drawBitmap(0, 20, 20, 80, imagePic, 0, 0);
    
            if(this.isFocus())
            {
                g.drawBitmap(0, 20, 20, 80, highlightedPic, 0, 0);
            }
    
        }
    }
    

    PLEASE HELP ME

    I found help here
    http://supportforums.BlackBerry.com/T5/Java-development/navigationClick-invoked-when-clicking-outsid...

    The position of Scribe the Lion was the solution.

  • Problem in designing a custom field for the display of paragraph

    Hello

    I need to develop a custom field that is supposed to act as a RichTextField with the additional of the hyperlink feature as seen in the web pages. I have a few paragraphs of text with an id associated with each of them. A paragraph may have link to another paragraph. I think that the hyperlink is actually like a button.

    My screen will consist of a single paragraph. If any hyperlink (id) in this paragraph is preesed then the screen reloads with another paragraph (id in a hurry).

    My problem is to develop a custom field for the display of this paragraph.

    Point: several lines of text without interruption. Some of the text may be bold, italic. a text can be the hyperlink.

    Now I'm stuck. I have no ideas how I can start with. Can someone give me please suggestions as to how I can start with?

    Thanks in advance

    Bika

    I have a different Suggestion.

    If you are using an ActiveRichTextField, you get two things:

    (1) the ability to shape a field using different fonts:

    Comment - formatting text in a RichTextField
    Article number: DB-00124
    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800345/...

    (2) the ability to create "links" automatically using string models

    How to-to comparison models in the BlackBerry smartphone to provide a user experience integrated applications
    Article number: DB-00525
    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800608/...

    Using models of string, I think you'd be able to create ' hot-link in your text, which the run Menu item was able to process you want.

    Just an idea.  Hope this works for you.

  • Custom field highlighting the problem

    Hello

    I have a custom field class that extends the field.  the custom class allows me to put a photo inside the field.  The problem I have is when I give him a click event, it accentuates not.

    I overrided onUnfocus() drawFocus() onFocus() and object;

    I tried to use super.drawFocus () inside the drawFocus(), tried to use drawHighlightRegion with HIGHLIGHT_SELECT and HIGHLIGHT_FOCUS but no luck.

    Anyone know what I need to do to give hightlight when the user touches the screen, or click?

    OK, so as I said in the previous post, you can paint the blue highlight, but your bitmap image will then paint over clear tones.

    So that the nail is visible, you must set a fill around the bitmap. In other works, the measurement of field must be slightly larger than the size of the bitmap.

    You the best solution would have been to extend BitmapField (rather than field) and use the setSpace() method to set some padding.

    Otherwise, you will need to adjust the measurement of field in your replacement of subLayout().

  • Adobe InDesign CC 2014 Custom Panel Built With Extension Builder - problem: cannot tab field one entry to another; Hit the tab hides instead all pallets; Is there a solution? It didn't happen in Adobe Indesign CC

    Adobe InDesign CC 2014 Custom Panel Built With Extension Builder - problem: cannot tab field one entry to another; Hit the tab hides instead all pallets; Is there a solution? It didn't happen in Adobe Indesign CC

    This should be corrected in the next version.

  • Problem with custom VerticalFieldManager, custom list field Call Back

    I created a custom vertical field Manager and a custom list field. It works very well in JDE 6.0.But when I build the same code in JDE 4.5 it throws the error because the setExtent Sub protected method (int width, int jeight) that I used in my code is final in JDE 4.5.

    so I changed my sublayout custom implemented code in vertical field Manager method. Again, this works very well in JDE 6.0.When I have to generate in JDE 4.5 is not to throw any errors.but when I run my code

    the list field does not have focus.

    I added a text field and a list custom field to the Vertical Field Manager text field focus but custom list field does not receive the focus. And the confusing part is when I click on the arrow to the getSelectedIndex from the scope of the list is changing and when I print listfield is active or not is the wrong impression.

    What is bad code works fine in jde 6.0 but not in jde 4.5, please let me know what I need to do something.

    Me as the ListField focus, but is not in fact poster it seems.  Have you made a

    . getLeafFieldWithFocus()

    to see if indeed he has the focus?

    I think we will have to see the ListField code for help.

  • drawFocus, drawHighlightRegion & XYRect is equivalent to a white rectangle in a custom field?

    It's one of those days where I should have stayed at home.

    Why the following sets a rectangle white when the false boolean value on?

    In other words, when it put there at the point, I get the highlight of rectangle of color TYellow as expected, when there is no discussion on the custom field (a class that extends the field); a white rectangle is drawn.

    I don't want to take anything either when there is no accent, which is equal to the value Boolean false.

    protected void drawFocus(Graphics graphics, boolean on) {
      paint(graphics);
      if (on) {
        XYRect rect = new XYRect();
        getFocusRect(rect);
        drawHighlightRegion(graphics, HIGHLIGHT_FOCUS, on, 0, 0, w, h);
             int prevColor = graphics.getColor();
         graphics.setColor(Colors.TYellow);
         graphics.drawRect(x, y, w, h);
         graphics.setColor(prevColor);
      }
    }
    

    Good or bad, I solved the problem by following these steps:

    1. My rectangle of drawing in paint with the previous color.
    2. Adding a call to invalidate in the onUnfocus method:
    protected void onUnfocus() {
      invalidate();
    }
    

    If there is a better, I'll be first in line.

  • 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).

  • Question view screen with custom fields

    I've developed a class that extends the scope and Implements DrawStyle. The field contains a bitmap with text drawn on the left of the it... nothing too complicated. I made focasable, has erased layout and drawFocus, painting, etc., but I'm having a Visual anomaly.

    On my screen (no title), I added a LabelField (non-active), and then a BitmapField (non-Focus), followed by a number of my custom fields. When the first screen, everything looks great. My first custom control has focus and is drawn as such.

    The problem occurs when I scroll through the custom control 3rd to 4th (causing the screen scroll), the 2nd custom control appears twice, the 3rd is missing and the 4th has the focus. There are also some white background that starts to show through (my controls are all black and is so the bottom of the screen and other controls).

    Of course, I'm having some trouble of painting, but it is certainly related to scrolling.

    What methods should be overritten in a custom control to ensure the scrolling will work properly?

    Which must be defined in the screen?

    1. prepare your screen unscrollable as:

    Super (NO_VERTICAL_SCROLL);

    2 use a VerticalFieldManager to add all of your components.

    Make sure verticalManager Scrollable and set its size and background color.

    Something like:

            mainManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR)
            {
                //setting background color
                protected void paintBackground(Graphics graphics)
                {
                    graphics.setBackgroundColor(0x00000000);
                    graphics.clear();
                    super.paint(graphics);
                }
                //setting its height and width
                protected void sublayout( int maxWidth, int maxHeight )
                {
                    int width = Display.getWidth();
                    int height = Display.getHeight();
                    super.sublayout( width, height);
                    setExtent( width, height);
                }
            };
    

    3. now add this to your screen.

    Now your screen does not scroll and you will not get the white background at the end.

    Let me know if you have any questions.

    Concerning

    Bika

  • Two sliders in the custom field definition

    Hi guys,.

    First of all, I want to thank all those who helped me to this day. This forum has been essential for blackberry dev work I do, and I would be screwed without you guys. That being said, I'm having a problem. I install a custom like this text entry field.

    (1) creates a vertical field Manager, assigned a background and resized image with setExtent(). (works fine)

    (2) created a new type of field and inserted in the vertical field Manager to make native look (almost works)

    The problem I have is that two sliders are appearing. Cursor #2 is dynamically updated as it should be, but the #1 cursor seems to be a "flawed slider. Please see the image below for details.

    The custom field is defined using the following code. If I remove the custom field, or cursors comes, so I am positive that it is the source of the problem.

        public class JustifiedEditField extends HorizontalFieldManager implements FieldChangeListener {
            BasicEditField ef;
    
            public JustifiedEditField(long style) {
                super(USE_ALL_WIDTH);
                ef = new BasicEditField(style) {
    
                    protected void onDisplay() {
                        setPosition(10, 17);
                        update(0);
                        //invalidate();
                    }
    
                    protected void update(int d) {
                        super.update(d);
                        setPosition(10, 17);
                        //invalidate();
                    }
    
                    protected void paint(Graphics graphics) {
                        graphics.setColor(Color.WHITE);
                        getFocusRect(new XYRect());
                        drawFocus(graphics, true);
                        super.paint(graphics);
                    }
    
                    protected void onUnfocus() {
                        invalidate();
                    }
    
                    protected void onFocus(int direction) {
                        invalidate();
                    }
    
                    /**
                     * Intercepts ESCAPE key.
                     * @see net.rim.device.api.ui.component.TextField#keyChar(char,int,int)
                     */
                    protected boolean keyChar(char ch, int status, int time) {
                        switch(ch) {
                            case Characters.ESCAPE:
                                // Clear keyword.
                                if(super.getTextLength() > 0)
                                {
                                    setText("");
                                    return true;
                                }
                        }
                        return super.keyChar(ch, status, time);
                    }
                };
                add(ef);
            }
    
            protected void sublayout(int width, int height) {
                super.sublayout(width, height);
                setExtent(width, 57);
            }
    
            public BasicEditField getEditField() {
                return ef;
            }
    
            public String getText() {
                return ef.getText();
            }
    
            public void setText(String value) {
                ef.setText(value);
                invalidate();
            }
    
            public void setChangeListener(FieldChangeListener changer ){
                ef.setChangeListener(changer);
            }
    
            public void fieldChanged(Field field, int context) {
                invalidate();
            }
        }
    

    I am totally stuck on this issue, any help would be really appreciated. TIA!

    I came up with an alternative solution. It turns out that I can use a transparent border to set the offsets to where the edit field must be located within the input Manager; thus eliminating the need to use setPosition.

  • Part of the cursor remains in the custom field

    Hello, guys!

    I have a problem.

    In the custom field that extends EditField, I want to draw in the text and the image and draw an appropriate in the cursor position. Then, we thought it would only calculate in advance of the police and the width of the image in the paint method to display the text and image and to the similar development and I tried. However, the cursor drawing is wrong. When the cursor moves from right to left, a part of the slider to the position immediately before the rest.

    Y at - it a good solution?

    JDE component package: 4.6.0

    I solved by myself.

    'FocusChangeListener' is mounted with EditField. And "invalidate()" has been called in the method "focusChanged().

    It became a great result for me.

    Thank you.

  • 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.

  • Create a virtual report machine include: Pool of resources with custom fields

    Hello

    I would like to create a VM report that includes the name of the virtual host computer and Discription, as well as the virtual machine Resource Pool belongs too.

    I would also report to query for custom fields, provide the names, values, and to give it in a format that works with export-csv.

    I have a start on the script and it included as an attachment.

    How should I go about adding custom fieldsvalues?

    How can I add the name of the Resource Pool of the report?

    Thank you in advanced for your help.

    Tim

    The problem with the CustomFields, is that I don't know how they are defined on a guest.

    It's a problem when you want to make an Export-Csv thereafter. The cmdlet can handle variable-length items in the table very well.

    That's why I put 1 CustomField in 1 rank.

    $report = @()
    Get-ResourcePool | %{
         $rpName = $_.Name
         $_ | Get-VM | %{
              $vmName = $_.Name
              $_.CustomFields | %{
                   $report += New-Object PSObject -Property @{
                        ResPool = $rpName
                        VM = $vmName
                        CustomName = $_.Key
                        CustomValue = $_.Value
                   }
              }
         }
    }
    $report | Export-Csv "C:\report.csv" -NoTypeInformation -UseCulture
    

    BTW, the Export-Csv cmdlet is a standard cmdlet. Has nothing to do with Dmitri.

    Note that the script in this format requires PowerShell v2 RTM

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Customizing fields using the BC & DW form builder

    I've created a form, "pre-order" as follows:

    1. CRM > extend CRM database, where I created the CRM data fields
    2. Web Forms > Add Web form > I added the form default CRM 'contacts' fields in the form BC Builder
    3. I then downloaded the form using DW and customize the fields; example: changed "at home" to "delivery address", removed the 'cell phone' field, changed "telephony" to "primary phone"...

    After pressing this form dates back to BC, I tested the form and the fields that I had custom data not in the CRM.

    Can someone help me with this problem?

    Thank you

    Catherine

    Thanks for your reply. In fact the form of CRM data works (data capture to CRM). His section of default contact form, where I customized fields that does not work. I now work with my 3rd BC tech on it as I write this response.

  • Displacement of the custom fields of one vCenter to another

    Hello

    I need to move my vcenter (or all esx hosts) of my new vsphere vcenter. I connect just 3.5 esx host for my new vcenter.

    as for this nice guide iam able to move old vcenter custom fields to my vcenter vsphere using export-csv.

    http://www.virtu-al.NET/2009/05/29/PowerCLI-on-steroids-custom-attributes/

    -


    Snip-


    Snip
    Snip

    Snip
    -.

    1. The export of all the attributes that have been customized in a CSV (backup)

    $list = @)

    $vmArray.GetEnumerator () | %{

    $vmName = $_. Name

    $_. Value.Custom.getenumerator () | %{

    $row = New-Object psobject

    $row | Add-Member - memberType noteproperty-name VmName-value $vmName

    $row | Add-Member - memberType noteproperty-name NomAC-value $customKeyLookup [http://$_.Name|http://$_.Name]

    $row | Add-Member - memberType noteproperty-name CAValue-value of $_. Value

    $list = $row

    }

    }

    $liste | Export-Csv "C:\CA-backup.csv" - noTypeInformation

    -


    Snip-


    Snip
    Snip

    Snip

    Snip
    -.

    so I connect vi PowerCli to my old vcenter 'connect-viserver' and export all of the CF, "reconnect" all the esx 3.5 to my vsphere vcenter server, connect to my new vcenter and import them accordingly:

    -


    Snip-


    Snip
    Snip

    Snip

    Snip
    -.

    1. Import all custom from a CSV (restore) file attributes

    Import-Csv "C:\CA-backup.csv" | %{

    $vmArray [http://$_.VmName|http://$_.VmName]. Object.setCustomValue ($_.) NomAC, $_. CAValue( )

    }

    -


    Snip-


    Snip
    Snip

    Snip

    Snip
    -.

    I can't run this code as a script itself snippets and my PS skills are limited, so here's my Question: could someone help me to get started?

    I guess I need to plug my vCenter first... as "Connect-VIServer vcserver.

    your help is very appreciated. Thank you

    rgrds uxmax

    Hi, thanks for the link

    Yes, you will need to connect to your server of VI using the cmdlet connect-viserver, something like this should do:

    to connect-viserver MYVISERVER

    Or if you need to move from other credentails as the account that you are using this as a use:

    SE connect-viserver MYVISERVER-user "myuser" - pass "myP@ssword"

    Once you have done this, you can run the export and then use the same cmdlet to connect to the other server of VI before importing the details.

    I hope this helps.  As a no, I also activated on my blog comments, it's a good way for everyone to see, too, how solve us problems.

    If you found this information useful, please consider the allocation of points for correct or helpful.

    Alan Renouf

    http://Virtu-al.NET

Maybe you are looking for

  • 3000 x 4 TouchPad / keyboard issue?

    I have started to have a rather odd behavior, the mouse pointer "selects" all the time (selection box), what is happening currently with the office and it randomly moving icons as if I have the selected with the mouse (touchpad) the keyboard seems to

  • How to remove shuffle on ipad

    Whenever I'm playing a playlist on my iPad is in the mode 'random '.  How can I remove this fashion? Thank you.

  • You can add other emoticons to those found in the IOS 9.2 emoji keyboard

    I would like to add emoticons to brighten up my calendar and others. While the emoji on iOS 9.2 keyboard has a lot of emoticons, I can't find some like the rod of Asclepius for medical appointments, not an image of a tooth for the dentist or a grocer

  • Tecra S2 video input

    How can I put on a video input on my Tecra S2. I want to play Xbox 360 in HD on my laptop. Is this possible? Maybe there is a docking station or something like that.Hope someone can help meGreetz

  • mSATA for netbook

    I have a HP Pavilion dm1 notebook.   More accurately it could be called a netbook (screen 11.6).  3 GB of ram and a hard drive of 320.  It's small and slow, but I like it.  Am interested in mSATA discs developed by crucial.  Namely, the