2 at the same HorizontalFieldManager DateFields

Hello everyone

Is it possible to have 2 DateFields in HorizontalFieldManager even?

I tried the following code, did not work.

Dtfm DateFormat = new SimpleDateFormat("HH:mm");
           
HorizontalFieldManager hmDisable = new HorizontalFieldManager();
HorizontalFieldManager hmFrom = new HorizontalFieldManager();
HorizontalFieldManager hmTo = new HorizontalFieldManager();
           
dtStart = new DateField ("disable:", System.currentTimeMillis (), dtfm);
dtTo = new DateField ("disable for:", System.currentTimeMillis (), dtfm);

hmFrom.add (dtStart);
hmTo.add (dtTo);

hmDisable.add (hmFrom);
hmDisable.add (hmTo);
            
Add (hmDisable);

Thank you

Never mind. I solved it by replacing sublayout.

Thank you

Tags: BlackBerry Developers

Similar Questions

  • EditField and checkboxfield on the same line

    public CheckFileScreen()
        {
            vfm = new VerticalFieldManager();
            left = new HorizontalFieldManager( Field.FIELD_LEFT);
            right = new HorizontalFieldManager( Field.FIELD_RIGHT);
            _Id = new EditField("Id : ", "", 6, EditField.FILTER_NUMERIC);
            _check = new CheckboxField("check", false);
                    left.add(_Id);
            right.add(_check);
            vfm.add(left);
            vfm.add(right);
            add(vfm);
            add(new SeparatorField());
        }
    

    on my above code tries to _id and _check on the same line, but the screen has been mess up

    +---------------

    | ID:

    | # check

    +----------------

    I want to create has been

    +----------------------

    | ID: # check

    +-----------------------

    could someone help me with this?

    This is the first time make app with GUI

    Gentlemen.

    slow down, please!

    Absolutely, totally useless any Manager available personalized for that! In order to organize two or more fields in a 'line', you just all of them to the same HorizontalFieldManager! The manager then places them from left to right in the order that you add them.

    That said - you have a slight problem in your EditField. EditField is "width-hungry" - it consumes the entire width, it is given, do not leave anything for the rest fields. To combat that, to deceive him into thinking he's got less space. We will give him what he needs to label 6 larger figures (s '8' or '9's, not '1') and a space for the padding. We will then have something like:

    _Id = new EditField("Id : ", "", 6, EditField.FILTER_NUMERIC) {
      protected void layout(int width, int height) {
        Font myFont = getFont();
        int myWidth = myFont.getAdvance(getLabel()) + myFont.getAdvance("8") * 6 + myFont.getAdvance(" ");
        super.layout(Math.min(myWidth, width), height);
      }
    };
    _check = new CheckboxField("check", false);
    HorizontalFieldManager hfm = new HorizontalFieldManager();
    hfm.add(_Id);
    hfm.add(_check);
    add(hfm);
    

    Enjoy!

  • EditField & ButtonField on the same line

    First of all, I would like to apologize in advance if there is already a resolution for this problem, I searched google on and off for a few days while working on other parts of my application, but have been unable to find advice.

    I'm not new to programming, but I am relatively new to java and very new to the BlackBerry that's why I worked on something relatively simple, so I can get used to the user interface of programming programming.  A question, I have been unable to solve is how to place an EditField and a ButtonField on the same line with ButtonField sitting against the margin and right the EditField take the place of the left margin at the beginning of the ButtonField.  Graphically, that's what I'm trying to achieve:

    | [- EditField-] [- ButtonField-] |

    I tried to place the two fields inside the same HorizontalFieldManager and placing each field it contains is own Vertical or HorizontalFieldManager.  I also tried to use the FIELD_LEFT / FIELD_RIGHT styles, but can not find a way to stop the EditField of push of the ButtonField off the screen and using the width of the entire line for himself.

    I begin to suspect that I need to learn how to code a custom field Manager, this is the case, or is there something much more simple that I'm missing?

    Thanks in advance,

    Russ.

    The following Threads must explain what is happening here and give you example of code that will help you overcome the problem:

    http://supportforums.BlackBerry.com/T5/Java-development/BasicEditFields-won-t-show-up-in-HorizontalF...

    http://supportforums.BlackBerry.com/T5/Java-development/custom-field/m-p/392585#M76156

  • Cannot add two text fields in the same row

    Hi, I would like to add to the field of text on the same line, but when I do that (add so much to a horizontal display manage) only appears on the screen.

    Any suggestions? Thank you.

    Hello

    This code snippet shows that the 2 textfields in the screen area by giving half the width of the screen in each textfield

    HorizontalFieldManager() = new HorizontalFieldManager Manager
    {
    ' public void sublayout (int width, int height)
    {
    Field field;
    int x = 0;

    Super.sublayout (width, height);
    super.setExtent (width, height);
    for (int i = 0; i)< getfieldcount();="">
    {
    field = getField (i);
    layoutChild (field, Display.getWidth () / 2, height);
    setPositionChild (field, x, 10);
    x += (Display.getWidth) / 2;
    }
    }
    };
    Field TextField = new TextField();
    Manager.Add (field);
    field = new TextField();
    Manager.Add (field);
    Add (Director);

  • CheckboxField, on the same line with OS6

    Hello

    I'm testing my apps for compatibility with OS6.  I discovered that if I have more controls, and then another on the same line, behavior went from OS5.  The first control's display while the other controls are moved outside of the screen.  Any idea on how to solve this problem while keeping compatibility?  Here's the code I'm referring to:

    HorizontalFieldManager hfmOperator = new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH);
    
    int intRightSpace = Display.getWidth()/10;
    
    LabelField lblOperator = new LabelField("");
    lblOperator.setFont(Font.getDefault().derive(Font.PLAIN, 18));
    lblOperator.setPadding(0, intRightSpace, 0, 0);
    hfmOperator.add(lblOperator);
    
    chkADD = new CheckboxField("+",  Param.boolActiveADD);
    chkADD.setFont(Font.getDefault().derive(Font.PLAIN, 24));
    chkADD.setPadding(0, intRightSpace, 0, 0);
    hfmOperator.add(chkADD);
    
    chkSUB = new CheckboxField("-",  Param.boolActiveSUB);
    chkSUB.setFont(Font.getDefault().derive(Font.PLAIN, 24));
    chkSUB.setPadding(0, intRightSpace, 0, 0);
    hfmOperator.add(chkSUB);
    
    chkMUL = new CheckboxField("*",  Param.boolActiveMUL);
    chkMUL.setFont(Font.getDefault().derive(Font.PLAIN, 24));
    chkMUL.setPadding(0, intRightSpace, 0, 0);
    hfmOperator.add(chkMUL);
    
    chkDIV = new CheckboxField("/",  Param.boolActiveDIV);
    chkDIV.setFont(Font.getDefault().derive(Font.PLAIN, 24));
    chkDIV.setPadding(0, intRightSpace, 0, 0);
    hfmOperator.add(chkDIV);
    
    add(hfmOperator);
    

    The only way I could get to this day is to override the method of layout in the CheckboxField and spend a fixed width to the super method:

    protected void layout(int width, int height) {
        super.layout(100, height);
    }
    

    The problem with this approach is that the width of the content can vary from a device to according to the size of font by default, etc. and it may be possible to try to force a specific width.

  • Manage icons on the same screen

    Hi team,

    I have the following icon in a file of my application:

    BitmapField phone = new BitmapField(Bitmap.getBitmapResource("phone.png"), FIELD_VCENTER);
    

    I have to show this icon more than once in the same file.

    I defined the following code:

    _manager = (VerticalFieldManager)getMainManager();
    
    _container_client_info = new VerticalFieldManager();
    
    _container_phone = new HorizontalFieldManager();
    _container_phone1 = new HorizontalFieldManager();
    
     XYEdges rounded_edges = new XYEdges(11, 11, 11, 11);
            Border rounded_content = BorderFactory.createBitmapBorder(rounded_edges, Bitmap.getBitmapResource(_resources.getString(IMAGE_BOX)));
    
    _container_client_info.setBorder(rounded_content);
    
    String _pType = _seed.getElement(HopperData.PHONE_TYPE);
    String _pType1 = _seed.getElement(HopperData.PHONE_TYPE1);   
    
    LabelField _phone_type = new LabelField(" " + _seed.getElement(HopperData.PHONE_TYPE) + ": ");
    LabelField _phone_type1 = new LabelField(" " + _seed.getElement(HopperData.PHONE_TYPE1) + ": ");    
    
    LabelField _phone = new LabelField(_seed.getElement(HopperData.PHONE), LabelField.USE_ALL_WIDTH);
    LabelField _phone1 = new LabelField(_seed.getElement(HopperData.PHONE1), LabelField.USE_ALL_WIDTH);
    
    _container_client_info.add(_container_phone);
    _container_client_info.add(_container_phone1);
    
    if (_pType.equals("Cell"))
       _container_phone.add(cell);
    else
       _container_phone.add(phone);
    
    _container_phone.add(_phone_type);
    _container_phone.add(_phone); 
    
    /**
      * Control for second phone.
      */
    String telephone1 = _seed.getElement(HopperData.PHONE1);
    
    if (!telephone1.equals("0"))
    {
       if (_pType1.equals("Cell"))
            _container_phone1.add(cell);
       else
    
            _container_phone.add(phone);
    
       _container_phone1.add(_phone_type1);
       _container_phone1.add(_phone1);
    }
    

    The result displays the following information:

    Icon1 phone Type 1: number of Phone.1

    ICON2 Type pf 2 phone: phone number 2

    in this case the icon1 and icon2 are the same when the phone type is differet to CELL

    Download

    Phone type: Home

    Phone type: work

    I'll show the same icon.

    So I have managers different vertical and horizontal for 1 phone and phone 2 that I will have to define the following code twice:

    BitmapField phone = new BitmapField(Bitmap.getBitmapResource("phone.png"), FIELD_VCENTER);
    

    O how is the icon even twice or more in the same screen.

    Thank you

    Jorge Luis

    Hello

    I think that in the current scenario, you need to create different BitmapField with the same resource i.e phone.png.

    I think that if appropriate, you can use a listfield and in each line, you can view the different entries and use the drawBitmap method to render the same image.

  • How to put the button on the same line

    I am having some problems with the buttons. I have the main screen with a verticalmanagerfield parent, who has two sons a richtextfield and an editfield (these two are the same on both of the gpsdemo)

    I want to put 3 buttons under the sons of two field and these 3 buttons that we're going to be son of verticalmanagerfield, but I can't put them on the same line

    I'll show you two pictures what I mean

    first image: I see now

    second image: what I want

                HorizontalFieldManager hfm = new HorizontalFieldManager()
                {
                    protected void sublayout(int width, int height)
                    {
                        Field field;
                        int numberOfFields = getFieldCount();
                        int x = 0;
                        int y = 0;
                        width=250;
                        height=50;
    
                        for (int i = 0;i < numberOfFields;i++)
                        {
                            field = getField(i); //get the field
                            setPositionChild(field,x,y); //set the position for the field
                            layoutChild(field, width, height); //lay out the field
                            x += 120;
                        }
                        setExtent(width, height);
                    }
                };
    
                 hfm.add(new ButtonField("Button 1"));
                 hfm.add(new ButtonField("Button 2"));
    
  • How to paint two ObjectChoiceField on the same line

    Hello Experts!

    I tried to draw two ObjectFieldChoice on the same line, but the work doesn´t, I found this post that have the same problem as me, but the fix doesn´t works for me.

    My code:

    ...
                      String[] tipos = new String[] {"BLA1", "BLA2" };
            _tipo = new ObjectChoiceField(null, tipos, 0, FIELD_VCENTER) {
                protected void layout(int width, int height) {
                    super.layout(width - 235, height);
                }
            };
            _tipo.setBorder(BorderFactory.createSimpleBorder(new XYEdges(1, 1, 1, 1)));
            _tipo.setFont(Utils.getFont());
    
            FCLabelField lblTipo = new FCLabelField(_tipo_filtro, FIELD_VCENTER, false);
    
            String[] opcoes = new String[] { "BLA3", "BLA4", "BLA5", "BLA6"};
            _situacao = new ObjectChoiceField(null, opcoes, 0, FIELD_VCENTER) {
                protected void layout(int width, int height) {
                    super.layout(width - 346, height);
                }
            };
            _situacao.setBorder(BorderFactory.createSimpleBorder(new XYEdges(1, 1, 1, 1)));
            _situacao.setFont(Utils.getFont());
    
            FCLabelField lbl = new FCLabelField(_filtro, FIELD_VCENTER, false);
    
            CustomButtonField btConsultar = new CustomButtonField("Submit");
            HorizontalFieldManager hfmButton = new HorizontalFieldManager(FIELD_VCENTER);
            hfmButton.add(btConsultar);
    
            HorizontalFieldManager hfm = new HorizontalFieldManager(FIELD_LEFT);
            hfm.add(lblTipo);
            hfm.add(_tipo);
            hfm.add(lbl);
            hfm.add(_situacao);
                      add(hfm);
    ...
    

    I m waitting for more help.

    Best regards, Rampelotti

    The way I would approach this scenario is firstly by adding two fields of object list to a horizontal management.

    Resize the fields until they are exactly where you want to be.

    Once you did, then you can begin to add the label fields, centering, resizing and so on.

    Do it step by step.

    Also subtract 200 + pixels in width is not a good idea, especially on small devices.

    Hope this helps

  • Two RichTextFields on the same line

    I am writing two RichTextFields in the same line, but one of them with a font in bold and plain text for the other. I do this, but for some reason any the second richtextfield is not shown in my screen. I have no idea what I'm doing wrong...

    myFontNegrita = Font.getDefault () .derive (Font.BOLD, 16);
    myFont = Font.getDefault () .derive (Font.PLAIN, 16);
          
    hfmHoraInicio = new HorizontalFieldManager();
    labelInicioAplicacion = new RichTextField ("my text:", Field.READONLY |) Field.NON_FOCUSABLE);
    labelInicioAplicacion.setFont (myFontNegrita);
           
    textoInicioAplicacion = new RichTextField ("blablabla", Field.READONLY |) Field.NON_FOCUSABLE);
    textoInicioAplicacion.setFont (myFont);
           
    hfmHoraInicio.add (labelInicioAplicacion);
    hfmHoraInicio.add (textoInicioAplicacion);

    Add (hfmHoraInicio);

    Thanks in advance.

    I guess that the RichtTextField takes all the available horizontal space by default. Perhaps the style RichtTextField #USE_TEXT_WIDTH help?

  • two radio buttons on the same line

    Hello

    I wanted to add two option buttons, which should appears on the same line, which is provided for in the other. How can ido that?

    I try like this:

    VerticalFieldManager vfmMain;
    HorizontalFieldManager hfmRadio;

    Household RadioButtonField, rSetup;

    Household = new RadioButtonField ("View");
    rSetup = new RadioButtonField ("Setup");

    hfmRadio = new HorizontalFieldManager (HorizontalFieldManager.FIELD_HCENTER);

    hfmRadio.add (household);
    hfmRadio.add (rSetup);

    vfmMain = new VerticalFieldManager(VerticalFieldManager.HORIZONTAL_SCROLLBAR |)
    VerticalFieldManager.VERTICAL_SCROLLBAR);

    vfmMain.add (hfmRadio);

    but his he sent me some exception.

    any idea?

    Thanks in advance.

    Hey guys find a solution very simple for this

    VerticalFieldManager vfmMain;

    HorizontalFieldManager hfmTemp;

    vfmMain = new VerticalFieldManager();

    hfmRadio = new HorizontalFieldManager();

    RadioButtonGroup grp;

    View RadioButtonField, Setup;

    GRP = new RadioButtonGroup();

    view = new RadioButtonField ('View', grp, true, RadioButtonField.FIELD_LEFT);

    Setup = new RadioButtonField ("setup", grp, false, RadioButtonField.FIELD_RIGHT);

    hfmRadio.add (view);

    hfmRadio.add (setup);

    vfmMain.add (hfmRadio);

    try this if someone is loking for the option button

  • Cannot restart or refresh my iPhone 7 from the "home" button and the sleep/wake button at the same time

    I'm having difficulty trying to restart and update my iPhone 7 using the Home button and the sleep/wake button at the same time, when I do my phone takes a screenshot of the home screen.

    Should I turn off my Touch ID?

    Basically my home button button and / standby works not together at the same time.

    You need hold the House and turn off the button for 20 seconds, until the Apple logo appears.

  • Can I connect the watch or Bluetooth headset at the same time?

    The watch or Bluetooth headset (maybe a pair of the Airpod) connect at the same time?

    I have iPhone 6 now and will update to 7 earlier.

    I do it all the time with my iPhone 6. I assume you mean to plug the headphones into the iPhone, right? Whatever it is, you can connect to the phone or watch.

  • FCPX guard leave unexpectedly after I do the same edit

    FCPX started just suddenly stop unexpectedly, often after a few changes, and the last time he is smoking after that I have try to do the same thing to change. Any ideas? I have the version 10.2.3, on El Captain 10.11.4

    Really hard to say where I'm sitting. FCPX accidents are often related to bad media. Maybe in the case, I have a feeling they are trying to use too many PDF files in a library, but this isn't what I can prove it.

    Open a backup copy of your project, from before your sequence crashing and see if it crashes. After the return. fans will have more questions for you. Patience.

  • A copy of the Sierra of MacOS and travel on the same volume

    I installed a new copy of the Sierra of MacOS, and most things seem to be well-oiled. However, I noticed that when I copy a file and paste it on the same volume, a copy of it remains in the original location. So, by example, if I download a file in the Downloads folder and then copy this file in Documents, a copy of the file remains in the folder downloads. On previous versions of Mac OS x, the default action might have to move the file of Di-ownloads of Documents. Is it possible to recover this feature?

    Another totally independent question is I see also that Terminal does not save orders, after its closure. So if I entered a command then close Terminal, after the reopening, I have to type the same command again. On older versions of Mac OS x, we could simply use the arrow keys to navigate through previous orders. Is it possible to recover this feature?

    Lojix wrote:

    So, by example, if I download a file in the Downloads folder and then copy this file in Documents, a copy of the file remains in the folder downloads. Is it possible to recover this feature?

    On older versions of Mac OS x, we could simply use the arrow keys to navigate through previous orders. Is it possible to recover this feature?

    Try the press / hold down the command key while you click and drag a file from one folder to another. Like El Capitan, this should move the file.

    About Terminal, the up/down arrows always work for me to remind the right Terminal commands like they did with El Capitan.

  • The fan runs all the time because xinetd running more than 80% all the time.  Someone else has the same problem?

    xinetd is running at 83% or more 24 x 7 devours battery in 2 hours or less and making the fan run all the time.  I am connected to a bug report, and it turns out that it was a duplicate because someone else had the same problem.  However, I have no access to the other bug report or find anything either in the discussion forums or online.  Anyone experience this problem?

    Hello gorgonzola1111,

    I doubt that someone else has this problem because xinetd does not part of macOS. Have you installed it from a package of "ports" 3rd party?

Maybe you are looking for