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.

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!

  • On my laptop, my google toolbar sharing the same line with the menu bar, I want that on my desktop PC, all have XP w/SP3

    On my Toshiba laptop that my Google toolbar is on the same line as the menu bar, I want that on my Dell desktop computers. All have Xp w/SP3. All computers are olde, and I am rich with time, but poor in cash. Thanks - L

    Hello

    What version of internet Explorer that you are using?

    You can unlock the toolbar then click, hold and drag the toolbar on the same line of the menu bar.

    Unlock toolbars to customize their

    Hope the helps of information.

    Please post back and we do know.

  • 2 phones connected to the same line with PAP2

    Hello

    Is it possible to connect a phone to the first port, a second, and use both in the same line?

    I configured and only works with a single line.

    Thank you

    Yair.

    Hello

    No, this is not the right way. The first port belongs exclusively to recording the line1, second port exclusively to recording of line 2.

    If you want two phones (such as another in the bedroom lounge) ringing on incoming call, simply use the "splitter" to make the phones at the same time and that's it - SPA/PAP Traffic has enough power to operate up to 3 analog telephone devices on each of the ports. I used to have 2 analog phones in parallel on (the only one) FXS ports of SPA-1001 and it works beautifully.

    PS: mae good course use you only 2-wire cable (internal thread) to connect the PAP2T FXS1 port and the phone (s). The 4-wire cable may make some analog phones crashing the device PAP2T IDE oucederomsurlesecondport FXS1.

  • Two RadioButton on the same line with any idea...

    Hello

    Can I add two RadioButton singel online...

    I m using HorizontalFieldManager with him

    but only the first button is visible... give me a solution simple and good for this please help me.

    Thank you

    Himanshu

    Beginner

    Please find the Code below and try it and let me know...

    radioButtonGroup = new RadioButtonGroup();
    
            radioButtonField = new RadioButtonField("Radio 1", radioButtonGroup,
                    true, 0) {
                protected void layout(int arg0, int arg1) {
                    setExtent(Display.getWidth() / 2, arg1);
                    super.layout(Display.getWidth() / 2, arg1);
                };
            };
            radioButtonField1 = new RadioButtonField("Radio 2", radioButtonGroup,
                    false, 0) {
    
                protected void layout(int arg0, int arg1) {
                    setExtent(Display.getWidth() / 2, arg1);
                    super.layout(Display.getWidth() / 2, arg1);
                };
    
            };
    
            HorizontalFieldManager hfmFieldManager = new HorizontalFieldManager() {
                protected void sublayout(int maxWidth, int maxHeight) {
                    setExtent(Display.getWidth(), maxHeight);
                    super.sublayout(Display.getWidth(), maxHeight);
                }
            };
    
            hfmFieldManager.add(radioButtonField);
            hfmFieldManager.add(radioButtonField1);
    
            add(hfmFieldManager);
    
            add(new LabelField("This label is below the two radio buttons",FOCUSABLE));
            add(new ButtonField("Click ME!"));
    
  • 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

  • Mr President, how can I enter two rows at the same time with different default values that only the first line to use see?

    Mr President.

    My worm jdev is 12.2.1

    How to enter two rows at the same time with different default values that only the first line to use see?

    Suppose I have a table with four fields as below

    "DEBIT" VARCHAR2(7) , 
      "DRNAME" VARCHAR2(50),
      "CREDIT" VARCHAR2(7) , 
      "CRNAME" VARCHAR2(50),
    

    Now I want that when I click on a button (create an insert) to create the first line with the default values below

    firstrow.png

    So if I click on the button and then validate the second row with different values is also inserted on commit.

    The value of the second row are like the picture below

    tworows.png

    But the second row should be invisible. It could be achieved by adding vc in the vo.

    The difficult part in my question is therefore, to add the second row with the new default values.

    Because I already added default values in the first row.

    Now how to add second time default values.

    Concerning

    Mr President

    I change the code given by expensive Sameh Nassar and get my results.

    Thanks once again dear Sameh Nassar .

    My code to get my goal is

    First line of code is

        protected void doDML(int operation, TransactionEvent e) {    
    
            if(operation != DML_DELETE)
                 {
                     setAmount(getPurqty().multiply(getUnitpurprice()));
                 } 
    
            if (operation == DML_INSERT )
                       {
                               System.out.println("I am in Insert with vid= " + getVid());
                           insertSecondRowInDatabase(getVid(),getLineitem(),"6010010","SALES TAX PAYABLE",
                            (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100));      
    
                           }
    
            if(operation == DML_UPDATE)
                              {                                                    
    
                                 System.out.println("I am in Update with vid= " + getVid());
                             updateSecondRowInDatabase(getVid(),
                                 (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100));      
    
                              }                      
    
            super.doDML(operation, e);
        }
        private void insertSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4, Object value5)
                  {
                    PreparedStatement stat = null;
                    try
                    {
                      String sql = "Insert into vdet (VID,LINEITEM,DEBIT,DRNAME,AMOUNT) values " +
                 "('" + value1 + "','" + value2 + "','" + value3 + "','" + value4 + "','" + value5 + "')";  
    
                      stat = getDBTransaction().createPreparedStatement(sql, 1);
                      stat.executeUpdate();
                    }
                    catch (Exception e)
                    {
                      e.printStackTrace();
                    }
                    finally
                    {
                      try
                      {
                        stat.close();
                      }
                      catch (Exception e)
                      {
                        e.printStackTrace();
                      }
                    }
                  }  
    
                  private void updateSecondRowInDatabase(Object value1, Object value5)
                  {
                    PreparedStatement stat = null;
                    try
                    {
                      String sql = "update vdet set  AMOUNT='"+ value5+"' where VID='" + value1 + "'";                     
    
                      stat = getDBTransaction().createPreparedStatement(sql, 1);  
    
                      stat.executeUpdate();
                    }
                    catch (Exception e)
                    {
                      e.printStackTrace();
                    }
                    finally
                    {
                      try
                      {
                        stat.close();
                      }
                      catch (Exception e)
                      {
                        e.printStackTrace();
                      }
                    }                  
    
                  }
    

    Second line code is inside a bean method

        public void addNewPurchaseVoucher(ActionEvent actionEvent) {
            // Add event code here...
    
            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
                   DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("VoucherView1Iterator");
                   RowSetIterator rsi = dciter.getRowSetIterator();
                   Row lastRow = rsi.last();
                   int lastRowIndex = rsi.getRangeIndexOf(lastRow);
                   Row newRow = rsi.createRow();
                   newRow.setNewRowState(Row.STATUS_NEW);
                   rsi.insertRowAtRangeIndex(lastRowIndex +1, newRow);
                   rsi.setCurrentRow(newRow);
    
                   BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry();
                   DCIteratorBinding dciter1 = (DCIteratorBinding) bindings1.get("VdetView1Iterator");
                   RowSetIterator rsi1 = dciter1.getRowSetIterator();
                   Row lastRow1 = rsi1.last();
                   int lastRowIndex1 = rsi1.getRangeIndexOf(lastRow1);
                   Row newRow1 = rsi1.createRow();
                   newRow1.setNewRowState(Row.STATUS_NEW);
                   rsi1.insertRowAtRangeIndex(lastRowIndex1 +1, newRow1);
                   rsi1.setCurrentRow(newRow1);
        }
    

    And final saveUpdate method is

        public void saveUpdateButton(ActionEvent actionEvent) {
            // Add event code here...
    
            BindingContainer bindingsBC = BindingContext.getCurrent().getCurrentBindingsEntry();      
    
                   OperationBinding commit = bindingsBC.getOperationBinding("Commit");
                   commit.execute(); 
    
            OperationBinding operationBinding = BindingContext.getCurrent().getCurrentBindingsEntry().getOperationBinding("Commit");
            operationBinding.execute();
            DCIteratorBinding iter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("VdetView1Iterator");// write iterator name from pageDef.
            iter.getViewObject().executeQuery();  
    
        }
    

    Thanks for all the cooperation to obtain the desired results.

    Concerning

  • How to choose the Department with employees in the same line?

    Hello world

    I need to make this request,

    Suppose we have 2 departments with n used on each Department

    I need to select the departments with only 2 employees in the same line, example here

    Department Name of Department Employee1 Employee2
    10HUMAN RESOURCESMarcSteve
    20HEPaul
    30New Department
    40FinanceJeanMichael

    This query below did not work because it only displays the first employee, but I need to display 2 employees (same as the above table)

    select
    deptno,
    (select ename from emp, dept where rownum =1 and emp.deptno = dept.deptno) employee1,
    (select ename from emp, dept where rownum = 2 and emp.deptno = dept.deptno) employee2
    
    from dept;
    
    

    ...

    I did this, but with the function returning the Emp2Dep1 Emp1Dep1

    function get_ename(p_dept number,p_col number)
    return varchar2
    is
        v_ename varchar2(4000);
        v_first boolean := true;
    BEGIN
            select ename
                  into v_ename
                  from
                      (
                      select ename, rownum as rn
                      from (
                            select ename
                            from emp ,dept
                            where    emp.deptno        = p_dept
                            order by 1 asc
                            )
               
                      )
                  where rn = p_col;       
              
    
         return v_ename;
    END;
    
    

    and simply put

    select
    get_ename(deptno ,1 ) employee1,
    get_ename(deptno ,2 ) employee2
    from dept;
    
    

    Is there a better way to do it?

    NB: database 11g

    Thank you

    Select the Department, employee1, employee2

    (select Department, name, cnt

    (name, department, row_number (select) at the NTC (partition by order of the Department by null)

    employees

    )

    where NTC<=>

    )

    Pivot (max (name) of the cnt (1 as employee1, 2 as employee2))

    order by Department

    DEPARTMENT EMPLOYEE1 EMPLOYEE2
    10 Marc Steve
    20 Paul -
    30 - -
    40 Jean Michael
    50 Alpha Beta

    Concerning

    Etbin

  • How to better master with this model s/n, sides IN and OUT in the same line.

    Hi all!
    I'm just facing some old historical table where, to the transaction recorded in the same line, something like:

    column name
    ==============
    ref_no,
    x_id,
    product_id,
    product_amt,
    -* IN part
    in_flag-(IN)
    in_customer,
    in_address,
    -* PORTION
    out_flag-(OUT)
    out_customer,
    out_address

    Nice shipping biz where we can have the two sides met in the same line, they have same value for IN and OUT_flag = actual values 'IN' and 'OUT', woou!
    I really expect to have this table in different model where a line is an entry, probably with PK = ref_no + in_out_flag.
    But it looks like I can do anything on this design, and now I choose upong xactions request entry and EXIT, IN/OUT fixing portions on a common part with the UNION. This, the only way I can see how to solve this problem, or I'm not right? And I need to pack all in the stored procedure.

    Appreciate your comments how to do this, I'm really new to Oracle, however have some exp.
    And comments about these models db as well! -).


    Best
    TR

    I don't understand what problem needs to be solved.

    What criteria an independent observer would conclude that a correct solution has been posted.

    Published by: sb92075 on September 11, 2010 17:19

  • How can I combine the navigation bar and the menu bar on the same line to save space?

    V29 Firefox seems to be a huge not backward in customization. I need to save room for the content so already I disabled the tabs and combined in the menu bar and the navigation bar on the same line. The url space is too long anyway. Now with v29 all my customization is gone and I can't get it back. I can move me is more points on the navigation bar to combine it with the menu bar. Why this was done? It limits only my ability to customize my browser? I'm very frustrated that you had a great browser and ruined.

    You should see Classic theme restaurateur, it contains many parameters. This module applies to customize Firefox 29. https://addons.Mozilla.org/en-us/Firefox/addon/classicthemerestorer/

  • The orange Firefox button and the Navigation toolbar is on the same line

    Someone interfered with my Firefox settings and goofed a bit. Now the orange Firefox button and the Navigation toolbar are on the same line/line, as shown in the image below. Can you help me with the Firefox orange button at the top of the Navigation toolbar (as usually is the case)?

    http://PUU.sh/4NoO8.jpg

    Thank you very much! I had this same problem. I'd rather have my tabs at the top, in line with the orange. For some reason any that an add-on reset my 'browser.tabs.drawInTitlebar' to false, which looked horrible and wasted a whole bar of space by the presence of a large space empty on the top of my screen. It fixed my problem!

  • I want the address bar so that my bookmark bar can show more than three icons when it is placed on the same line.

    I have about five to ten icons bookmark in the same line as the search and address bar. So I use customize... and I put the bookmarks on the same line bar. I leave the "name"-textbox in each bookmark in white so that only the icons. ""

    However, only two icons appear and the rest are displayed in a drop-down list with an arrow you click.

    I need not address bar to take 70% of the screen. I don't want the bookmarks bar to use an additional line. I just want to have the icons of bookmark five to ten next to my search and address bar. Is this possible?

    The address bar and the search bar, that both have a flex attribute that makes then take all available space.

    Items in Bookmarks Toolbar folder probably has a minimum width that can just make a bookmark with a maximum length label (in your case two icons).

    You can set the width of the address bar and the search bar to force a maximum width of these two bars max.
    Definition of a minimum width for the bookmarks toolbar items will probably work as well.

    Add code to the file userChrome.css below default @namespace (setting the width according to your needs).

    Customization files (interface) userChrome.css and userContent.css (Web sites) are located in the chrome folder in the user profile folder.

    @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    
    #urlbar-container { max-width: 400px !important; }
    #search-container { max-width: 200px !important; }
    

    You can use this code to set a minimum width for bookmarks toolbar items if you want to experiment with that.

    You may need to set a width max as well.

    #personal-bookmarks { min-width: 200px !important; }
  • How can I leave toolbars 2 (or more) share the same line?

    I would like to have 2 or more toolbars that do not have an entire line share the same line (such as MS Word or Acrobat Reader).
    Is this possible?

    See this KB article - https://support.mozilla.org/en-US/kb/customize-firefox-controls-buttons-and-toolbars

    Experiment with these toolbars and see what is possible with these specific toolbars. Firefox has this capability, most of the time, but each developer toolbar must provide the coding of their add-on to enjoy what Mozilla has integrated into Firefox.

    My guess is that a well made toolbar add-on has three times the code that has a toolbar add-on minimum effort. Too many developers toolbar these days take the easy way and do not have their add-on to be "flexible".

  • Please explain CVI question #335358: using the operator of bit-shift twice on the same line of code produces incorrect results

    Hello

    I just stumbled on http://www.ni.com/white-paper/12323/en#335358_by_Category.

    With the help of the bit-shift operator twice on the same line of code produces incorrect results.
    Workaround: Separate the operations of shift of two bits in two distinct lines of code.

    Reported Version: 9.0    Solved Version: N/A    Added the: 14/02/2012

    Could someone please explain what kind of construction causes such a question?

    I have not noticed problems again and not have not noticed or found a thread about it.

    Thank you.

    The reported scenario looks like this:

    unsigned int a = 1, b = 62;
    unsigned  long long result = 1ULL << a << b;
    

    The problem arises because of the temporary variable used when do two little is placed in the same line. This separation into two lines will produce correct results:

    unsigned int a = 1, b = 62;
    unsigned  long long result = 1ULL << a;
    result = result << b;
    
  • 3 Jpeg files on the same line of document

    I've inserted 3 jpeg files into a document and can not group or move.  I reduced the margins to try to spread out so I could keep all files 3 JPEG on the same line in the document, but can't seem to do anything back.  Any suggestions?

    Hello

    What program you use to edit the document?

    If you are using an Office application, and then publish your request on the Microsoft Office support forums.

    http://answers.Microsoft.com/en-us/Office

    If you use another program, and then provide us with more information.

    Kind regards
    Afzal Taher
    Microsoft technical support engineer

Maybe you are looking for