Custom Edit Box Focus / number of character position

I have a text field within a HorizontalManager (I tried Vertical and Manager as well), but I'm getting a weird problem that it won't navigate left in some and is sail on other screens!

   public CustomEditField(int textcolor,Font font ,int maxchars,long style){
        super(style|Manager.HORIZONTAL_SCROLL);
        color=textcolor;
        bordercolor=TemplateSettings.bordercolor;
        editfield=new EditField(EditField.NO_NEWLINE|style|EditField.FOCUSABLE){
            public void onUnfocus(){
                System.out.println("Edit Field UnFocus");
                super.onUnfocus();
                this.invalidate();

            }

            public void onFocus(int direction){
                super.onFocus(direction);
                this.invalidate();
            }

            public void paint(Graphics g)
            {
                g.setColor(color);
                super.paint(g);

            }

            protected void drawFocus(Graphics g,boolean on){
                XYRect focusRect = new XYRect();
                getFocusRect( focusRect );
                int yOffset = 0;
                if ( isSelecting() )
                {
                    yOffset = focusRect.height >> 1;
                    focusRect.height = yOffset;
                    focusRect.y += yOffset;
                }
                g.pushRegion( focusRect.x, focusRect.y, focusRect.width, focusRect.height, -focusRect.x, -focusRect.y );
                g.setBackgroundColor( TemplateSettings.focuscolor );
                g.setColor( 0xFFFFFF );
                g.clear();
                this.paint( g );
                g.popContext();

            }

        };

He'll just go to the next/previous field instead of changing the position of the character (although sometimes it works ok in one way or the other!, it works very well if the text is more than a line well, someone knows how to bypass?, I tried the substitution of movement of navigation but is not getting hit at the level field or Manager?)

I have problems with the custom field grid Manager and the navigationmovement in there.

Tags: BlackBerry Developers

Similar Questions

  • How to make a text field to accept a capital letter has or a number in the position of the first character and only the numbers after that?

    Hi all

    We have a text field in one of our screen in our mobile app. Currently the user can enter alpha numeric characters in this text field.

    It is now that this field should accept a capital letter A or a number in the position of the first character and only the numbers after that.

    Could someone let us know how to do this?

    Thank you.

    Or, how about the substitution of this abstract method in textFilter?

    public boolean validate(character char,
                            AbstractString text
    int position)

  • Edit box "Padding".

    I have an edit box custom that has rounded corners and may have a different background color when highlighted.  However when I put two of them inside a vertical Manager there is no filling between them.

    I tried to adjust getPreferredHeight, but it has no effect.  Any ideas?

    Thank you.

    public class RoundedEditField extends BasicEditField {
    
        private int iRectX = getFont().getAdvance(getLabel());
        private int iRectWidth = Display.getWidth() - iRectX - 4;
        private int fontHeight = getFont().getHeight();
        private int editColor = Color.WHITE;
    
        public RoundedEditField(String label)
        {
            super(label,"");
        }
    
        public RoundedEditField(String label,String value)
        {
            super(label,value);
        }
    
        public int getPreferredHeight() {
            return 100;
        }
    
        public void onFocus(int direction)
        {
    
            editColor = Color.LIGHTBLUE;
            this.invalidate();
            super.onFocus(direction);
        }
    
        public void onUnfocus()
        {
    
            editColor = Color.WHITE;
            this.invalidate();
            super.onUnfocus();
        }
    
        public void layout(int width, int height) {
            setExtent(width, getPreferredHeight());
            super.layout(width, getPreferredHeight());
        }
    
        public void paint(Graphics g) {
            g.clear();
            g.setColor(editColor);
            g.fillRoundRect(iRectX-5, 0, iRectWidth, fontHeight,20,20);
            g.setColor(0x00000000);
            g.drawRoundRect(iRectX-5, 0, iRectWidth, fontHeight,20,20);
    
            super.paint(g);
        }
    
    }
    

    The concept of field brace worked well for me.  I got a code of another post - here, it's for someone else, it can be useful.

    import net.rim.device.api.ui.*;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.container.*;
    
    public class SpacerField extends Field {
    
            int localWidth, localHeight;
    
            SpacerField(int width, int height) {
                super(Field.NON_FOCUSABLE);
                localWidth = width;
                localHeight = height;
            }
    
            protected void layout(int width, int height) {
                // TODO Auto-generated method stub
                setExtent(localWidth, localHeight);
            }
    
            protected void paint(Graphics graphics) {
    
            }
    
            public int getPreferredWidth() {
                return localWidth;
            }
    
            public int getPreferredHeight() {
                return localHeight;
            }
    }
    
  • Problem with custom dialog box

    I have a custom dialog box. The code goes here

    import net.rim.device.api.system.Bitmap;
    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.component.Dialog;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    import net.rim.device.api.ui.decor.BackgroundFactory;
    
    public class CustomDialog extends Dialog{
    
        public CustomDialog(int command,String msg,int color,int alpha){
             super(command, msg, command,Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION), VerticalFieldManager.FOCUSABLE);
             setBackground (BackgroundFactory.createSolidTransparentBackground (color, alpha));
        }
    
    }
    

    I'm the caller to another class as follows

    CustomDialog d = new CustomDialog(Utils.D_YES_NO,"Do you want to exit",Color.BLUE,140);
    d.show();
    

    Its display very well and as I intended it to be. But the problem is that I'm not able to get the index of the choice to perform certain actions, such as

        int i=d.getSelectedValue();
    
                        if(i==Dialog.D_YES){
                            Dialog.alert("hi");
                        }
    
                        }
    

    Its do not call the dialog box, can anyone suggest me how to get the index of the choice that I chose to say YES or NO and to perform tasks accordingly

    Plese try suite

    CustomDialog d = new CustomDialog(Dialog.D_YES_NO,"Do you want to exit",Color.BLUE,140);
                    d.show();
                    d.setDialogClosedListener(new DialogClosedListener() {
    
                        public void dialogClosed(Dialog dialog, int choice) {
                            /*
                             *   // Field descriptor #211 I
                                  public static final int YES = 4;
    
                                  // Field descriptor #211 I
                                  public static final int NO = -1;
                             */
                            int i=choice;
                            System.out.print("Selected Value :"+choice);
                            if(Dialog.YES==choice){
                                System.out.println("Selected Value : YES");
                            }else if(Dialog.NO==choice){
                                System.out.println("Selected Value: NO");
                            }
    
                        }
                    });
    

    If it is useful, please make as response and do not hesitate on LIKE button thanks

  • Models menu DVD how come with first elements 12 edition box?

    Models menu DVD/Bluray how come with first elements 12 edition box?  The last time I bought elements 9 download version and it doesn't have a lot of models.  If I update, I want to ensure that I have several available DVD/bluray menu templates.

    Thank you

    Andrew

    Andrew

    The same amount of models of DVD that come with downloading purchased online.

    It is no longer a content disk included in the box in a box. Who went out of existence with Premiere elements 11. Now all get the download content within the program.

    Please read part 3 content of my blog on first things First Look 12.

    First Elements ATR troubleshooting: first items 12 first look details

    In addition, the situation with the download of content for all.

    http://www.atr935.blogspot.com/2013/05/pe11-no-content-disc-content-downloads.html

    The situation prevailing in Premiere Elements 9.0/9.0.1 with replacement of menu sets that do not appear in the DVD-VIDEO over to DVD disc does not exist in other versions.

    On a positive note, the menus photoshop.com more disk that are more accessible to users of Premiere Elements 9.0/9.0.1 are now available first items 11 and 12 as part of disc menus provided with the program.

    If you need more information than the foregoing, as all disc menus, please let me know, and I compile one for you.

    RTA

  • One of your filters uses a custom header that contains an invalid character.

    When I send an email, you receive the following error message:

    «One of your filters uses a custom header that contains an invalid character, such as ':', a nonprintable character, a non-ascii character or an 8-bit ascii character.» Please change the msgFilterRules.dat file, which contains your filters to remove characters not valid in your custom headers".

    It is followed by a message saying that the email was sent and saved despite the error.

    The problem occurred after the transfer to 10 Windows (from Win 7)

    I deleted all files msgFilterRules.dat and all filters, but the message persists.

    Any suggestions on what else to try?

    Thank you
    Ben

    Problem solved.

    After you delete all files/imap mail entries, the problem disappeared.

  • Edit box does not work for other users

    I have created a dialog box using one of my scripts.

    However, it only seems to work for me.  When I share all my files with another user of tiara on my place of work, he can't enter a value in the EditBoxes.

    Is there a setting somewhere that he needs to make sure is active, or do I have to change something in my dialog box?

    Thank you.

    I don't know why it happens, but if you increase the vertical size of the edit boxes a bit more, it works.

    Maybe it is related to the parameters of resolution/screen fonts.

  • Source code for Halo Custom Edition

    Halo Custom Edition has been placed on the PC more than 10 years ago and since then, the communities have worked with it to create amazing content for years, however, we hit a roadblock. We are limited by the power of the engine, something that we cannot solve without the source code. Halo CE is no longer supported by Microsoft, and since then it was largely up to the modders to work around him. is given his age, possible that the source code for Halo Custom Edition may be made public?

    You can try to contact Microsoft, but I guess it's unlikely.

  • Custom dialog box

    Hi all

    I need to have custom dialog boxes. I whent through http://developer.blackberry.com/native/documentation/cascades/ui/dialogs_toasts/tutorial_create_a_cu... this tutorial.

    But I need to build in the PRC.

    is this possible?

    I tried everything done porting the UTU in QML to CPP, by extending the Dialog class and all, the dialog box appears, but it is not black as when we show SystemDialog.

    isn't this possible in the PRC?

    Help, please!

    Kind regards.

    Found the solution! Make a custom control that looks like a dialog box, I need and behind the same added a container with blackish transparency to give it a feel of a system dialog box. and also, the user will not be able to interact with the screen as long as the dialog box appears on the screen.

    Kind regards.

  • Custom HorizontalFieldManager problem focusable

    I had a VerticalFieldManager with a list of items.

    Each element is a HorizontalFieldManager custom, composed by other fields. These custom fields are FOCUSABLE by manufacturer.

    I would like to have the first element of the list selected/focused when I view my list of items.

    If I try to set focus on the first point of

    firstItem.setFocus)

    nothing seems to be happening: the debbugger says "FocusHistory: Focus acquired; App Tesssst; Component TestScreen.

    TestScreen is

    public class TestScreen extends MainScreen{
    
        BitmapField _placeholder;
    
        public TestScreen() {
            super(NO_VERTICAL_SCROLL | NO_VERTICAL_SCROLLBAR);
    
            Background tiledBG = BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("grey_tile.png"), Background.POSITION_X_LEFT, Background.POSITION_Y_TOP, Background.REPEAT_BOTH);
    
            getMainManager().setBackground(tiledBG); 
    
            HorizontalFieldManager horizontal = new HorizontalFieldManager(NO_HORIZONTAL_SCROLL|NO_HORIZONTAL_SCROLLBAR);
            CustomVerticalManager listVerticalContainer = new CustomVerticalManager(VERTICAL_SCROLL|NO_VERTICAL_SCROLLBAR);
    
            add(horizontal);
            horizontal.add(listVerticalContainer);      
    
            for(int i=0; i<19; i++){
                _placeholder = new BitmapField(Bitmap.getBitmapResource("imageplaceholder.png"));
    
                HorizontalItemField item = new HorizontalItemField(_placeholder, "ASD", "sukapub", 2, "100$", FOCUSABLE);
                listVerticalContainer.add(item);
                if(i == 0) item.setFocus();
            }
    
            System.out.println("@#@#@# FOCUSED ITEM = "+getFieldWithFocus());
    
        }
    

    This one:

    System.out.println("@#@#@# FOCUSED ITEM = "+getFieldWithFocus());
    

    Returns:

    @# @ #@ # AXÉ ITEM = null

    Firstly, FOCUSABLE is supposed on connectors and downloaders - only fields.  If a manager has any focusable inside fields, its setFocus() will find the first such focus area and set to it. Compare the getFieldWithFocus() and the getLeafFieldWithFocus() to see the difference. In all cases, make sure that your _itemDetails is created focusable.

    Second, I noticed that you do not add _name, _publisher _price to your manager. Your sublayout is not also remove those. I can only imagine you send these fields to be placed somewhere else or

    Thirdly, given that you override sublayout anyway, consider the extension Manager rather than HorizontalFieldManager.  You can also use setMargin _image and _itemDetails drop sublayout() in total.  Even if Field.setMargin was documented in OS 6.0, he works since pretty much forever (my guess is since 4.0.0 - version where XYEdges appeared).

    Fourth - onFocus and onUnfocus managers are odd to say, I wouldn't count on them. onUnfocus, in particular, is wrong even in areas - could not get called at all. Use FocusChangeListener to detect the focus moves. Just add 'implements FocusChangeListener' to your class definition, implement ' public Sub focusChanged (field field, int eventType) and invoke setChangeListener (this) somewhere in the constructor. Respond to the types of FOCUS_LOST and FOCUS_GAINED events inside focusChanged and buttonColor and textColor changes - and don't forget invalidate()!

  • Custom edit field - not drawing while typing of the text

    I created a custom edit field (code below), but there is no slider or text drawn while typing.

    The text appears if you click another field on the screen, but not while typing. I guess it has something to do with my method of painting, but I don't know?

    Tips for making more effective methos painting would be a bonus!

    Thank you!

    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.FontFamily;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.component.EditField;
    
    public class CustomTextField2 extends EditField {
    
        private int fieldWidth;
        private int fieldHeight;
        private int button_colour = 0xF9F9F9;
        private int text_colour = 0x666666;
        private int border_color = 0xCCCCCC;
        private Graphics graphics = null;
        public CustomTextField2(long arg0) {
            super(arg0);
            fieldWidth = Display.getWidth()-100;
            //int off = 8;
            FontFamily fFam = null;
    
            try {
                fFam = FontFamily.forName("SomeFontHere");
            }
            catch (ClassNotFoundException e) {
                e.printStackTrace();
            }  
    
            Font font = fFam.getFont(Font.PLAIN, 20);
    
            Font defaultFont = font;
            int off = 8;
            fieldHeight = defaultFont.getHeight() + off + 10;
            this.setPadding(5, 20, 5, 20);  }
    
        protected void paint(Graphics graphics) {
    
            graphics.setColor(button_colour);
            graphics.fillRect(0, 0, fieldWidth, fieldHeight);
            graphics.setColor(border_color);
            graphics.drawRect(0, 0, fieldWidth, fieldHeight);
            graphics.setColor(text_colour);
            graphics.drawText(this.getText(),20,10/2);               super.paint(this.graphics);
        }
    
        protected void onFocus(int direction) {
    
            button_colour = 0xF9F9F9;
            text_colour = 0x666666;
            border_color = 0x3598CC;
            this.invalidate();
        }
    
        protected void onUnfocus() {
    
            button_colour = 0xF9F9F9;
            text_colour = 0x666666;
            border_color = 0xCCCCCC;
            this.invalidate();
        }
    
        protected void drawFocus(Graphics graphics, boolean on) {
    
              super.drawFocus(graphics, on);
        }
    
        protected void fieldChangeNotify(int context)
        {
            try {
    
            this.getChangeListener().fieldChanged(this, context);
    
            }
            catch (Exception e){
    
            }
        }
    
        public int getPreferredHeight() {
    
            return fieldHeight;
        }
    
        public int getPreferredWidth() {
    
            return fieldWidth;
        }
    
        protected void layout(int arg0, int arg1) {
    
            setExtent(getPreferredWidth(), getPreferredHeight());
        }
    }
    

    I just posted a code in another thread - he does most, if not all, of what you want. Take a look:

    Custom elegant EditField (textbox)

  • Try to install items with purchased 14 box serial number and system does not... What are the next steps?

    Try to install items with purchased 14 box serial number and system does not... What are the next steps?

    Are you sure have a serial number from the inside of the box, or you could have a redemption code?

    Find your http://helpx.adobe.com/x-productkb/global/find-serial-number.html serial No.

    What is the exact error message?

    Redemption Code http://helpx.adobe.com/x-productkb/global/redemption-code-help.html

    - and https://forums.adobe.com/thread/1572504

  • I can import the video and put it in the format of movie, but I don't see anything in the editing box

    I can import the video and put it in the format of movie, but I don't see anything in the editing box

    Try:

    FAQ: Why no audio or video will not at the track where I let down?

  • Name to appear first in the custom dialog box pop-up list

    Hi Forum.

    Thanks for the support so far.  I'm creating a simple custom dialog box which will be "popup", few names in the drop-down list.

    I read an external txt file bearing the name corresponding to the drop-down list. I try to display the name "Stephen" in the txt file as the first and then others follow one by one. Please help on this.

    name listed in the pop-up window

    Dialog.Load ({}

    names of:

    {

    'The King':-1.

    'Queen':-2,.

    'Jack':-3,.

    "Stephen":-4,.

    "Robert":-5,.

    }

    })

    He tried as below but found that the myList3 variable is directly instead of its value ("Stephen").

    Dialog.Load ({}

    names of:

    {

    myList3 : + 1, / / the variable myList3 will be known as "Stephen" stored inside.

    'The King':-1.

    'Queen':-2,.

    'Jack':-3,.

    "Stephen":-4,.

    "Robert":-5,.

    }

    })

    Appreciated your timely help on that. Thank you.

    See examples 3 and 4 in the execDialog API reference.

  • By creating a form that has several text boxes to a single character on the same line, how can I get the cursor to go in the next text box automatically after inserting a character?

    By creating a form that has several text boxes to a single character on the same line, how can I get the cursor to go in the next text box automatically after inserting a character?

    Create a text field and use the option 'comb n characters.

Maybe you are looking for