CustomButtons

Hey all, I'm really enjoying the waterfalls of controls available. I want to make a circular button and I was wondering what would be the best way to do it. I plant to have the button change color onTouched and I was wondering if I could modify an existing control or if I need to make one from scratch.

Right now I was going to just make images, normal and affected and their sub in the Notecard, is there a better way to do this? Also, when images of anchorage, what should I do to get a nice transition as in the button control existing? Is it possible to have a transition melted with the anchoring of the images? Thank you!

https://developer.BlackBerry.com/Cascades/documentation/UI/integrating_cpp_qml/custom_control_tutori...

Sorry, I wanted to include a link to the circular slider

Graham

Tags: BlackBerry Developers

Similar Questions

  • Buttons

    Hello users Diadem

    I'm a new user for Diadem, I created my own function analysis and calculation and made an interface to it with a dialog box, I want to create a new button in the interface of tiara, when it is selected, the user dialog box to appear, I tried to implement that, but it doesn't market always give error , here is my code

    Dim

    MyBar

    IfnotBarManager.Bars.Exists ("MyBar") ThenSet MyBar = BarManager.Bars.Add ("MyBar")

    On the other

    Set MyBar = BarManager.Bars ("MyBar")

    Call MyBar.UsedActionObjs.RemoveAll

    EndIf

    Dim mybutton

    IfnotBarManager.ActionObjs.Exists("Sensitivity") ThenSet oButton = BarManager.ActionObjs.Add ("Sensitivity", "CustomButton")

    MyButton. OnClickCode.Code = 'Call SUDDlgShow ("Dlg1", "Sens.SUD", NULL)'

    PS: the error comes from the last line!

    If someone has implemented this procedure I'll wait your sweet replay . I just want to know the method how to call the dialog box when the user clicks on the button

    Thank you very much in advance

    Aladdin

    Design engineer

    Hello Madishah,

    in your last line

    MyButton. OnClickCode.Code = 'Call SUDDlgShow ("Dlg1", "Sens.SUD", NULL)'

    You must use double quotation marks in the string. If the line should be:

    MyButton. OnClickCode.Code = 'Call SUDDlgShow ("" Dlg1"", "" Sens.SUD"", NULL)'

    This is how you define a quote with a string in VBScript

  • Problems running the example NavigationPane

    Hi, just trying to get an idea how to use the NavigationPane in my application.

    I'm trying to follow this example: https://developer.blackberry.com/cascades/reference/bb__cascades__navigationpane.html
    This is how my class looks like where I want to add a NavigationPane:

    
    import bb.cascades 1.0
    
    NavigationPane {
        id: navigationPane
    
    Page {
    
        // Root Container
        Container {
    
           ...
    
               CustomButton {
                      text: "Click me"
                      btnBackground: "asset:///btn-lightblue.png"
                      btnSelected: "asset:///btn-green.png"
                      bottomPadding: 12.0
                      topPadding: 12.0  
    
                     // This is where I want the second Page to show up
                     onTouch: {
                           var page = pageDefinition.createObject();
                           navigationPane.push(page);
    
                     }
    
                      attachedObjects: ComponentDefinition { // where should this go?
                                                   id: pageDefinition;
                                                   source: "SecondDialog.qml"
                      }
    
              }
    
        ...
    
        } // Container
    
    } // Page
    
        onPopTransitionEnded: { page.destroy(); }
    
    } // Navigation Pane
    

    But when the user clicks on the button "Click me" the SecondDialog.qml does not appear... Can someone point out what I'm doing wrong...? Thank you.

    OK, it is resolved, the problem is in the second page I add me to the navigation pane, missed me an "import bb.cascades 1.0" - it

  • Custom with the alignment of the icon button

    Hi, I created a custom in QML button which has the ability to add a background image,

    and the icon to the left of the text and a text itself.

    However, I have following problem. If the text and icon are defined, then the button is correctly

    displayed, if however only text is set and no icon, the text not be positioned in the

    I would, however, it leaves little room for the ImageView (which is empty).

    Can please somebody give me advice how to fix this? that is, when no icon is

    overall, I want the text to position itself in the Dunière. Is it possible to do this? Thank you.

    PS. Here is the code:

    Container
    {
    //elsewhere I set the background of my button
    ....
         // text and the icon on the left
         Container {
             verticalAlignment: VerticalAlignment.Center
             horizontalAlignment: HorizontalAlignment.Center
    
             layout: StackLayout {
                     orientation: LayoutOrientation.LeftToRight
                 }
    
              // Button Icon
             ImageView {
                 verticalAlignment: VerticalAlignment.Center
                 id: btnIconID
                 imageSource: btnIcon
                 minWidth: 50.0
                 minHeight: 50.0
            }  
    
            // Button Title
            Label {
               id: label
               text: "Add your text here"
               textStyle.base: SystemDefaults.TextStyles.smallText
    
               verticalAlignment: VerticalAlignment.Center
               horizontalAlignment: HorizontalAlignment.Center
    
               textStyle.color: Color.create("#ffffffff")
               textStyle.fontWeight: FontWeight.Bold
            }
        }
    ...
    }
    

    Here's how to use this button somewhere else:

    
           // on this button text and icon are correctly positioned
           CustomButton {
                       text: "Button 1"
                       btnBackground: "asset:///btn-default.png"
                       btnSelected: "asset:///btn-selected.png"
                       btnIcon: "asset:///someicon.png"
               }
    
           // here not; because there is no icon, and the text is
           // not centered anymore as I explained above
           CustomButton {
                       text: "Button 1"
                       btnBackground: "asset:///btn-default.png"
                       btnSelected: "asset:///btn-green.png"
               }
    

    Hello

    Use the 'visible' property to hide the ImageView.
    I don't know if it will work:

    ImageView
    {
    visible: imageSource.length! = 0
    ...
    }

    If it doesn't, try to set this property to the initialization:
    btnIconID.visible = false;

  • Border problem

    Hey all, I'm creating a customButtons using the basic model published by BB and I was wondering how to get rid of the border? I have spots of darker colours which generate a horrible color border when created, and I was wondering how to solve this problem.  I tried to create a border with custom XYedges, however this has no effect. What is the easiest way to solve the problem?

    as always, thank you guys.

    Maybe it's not the border.

    It could be the focus or something that is painted in her object or paintBackground().

    Try substituting the methods:

    1 drawFocus

    2 paint

    3 paintBackground

    And see if it has an effect.

    E.

  • Problem with fieldChanged() and custom button field

    Hello

    I created a custom button class by extending LabelField.  I chose LabelField over field because the LabelField contains desirable properties that are already being implemented.  The only problem I'm having has to do with the change listener.  It seems to 'steal' the event click on other areas in my application.

    For example, when I click on the custom button, a popupscreen with a listfield opens. When I click on an item in the listfield, then the fieldChanged() of custom button is called again...

    Can you see anything wrong with my code?

    package com.rantnetwork.fields;
    
    import com.rantnetwork.app.Constants;
    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.Ui;
    import net.rim.device.api.ui.XYEdges;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.decor.BackgroundFactory;
    import net.rim.device.api.ui.decor.BorderFactory;
    
    public class CustomButtonField extends LabelField {
    
        private boolean highlighted = false;
    
        public CustomButtonField(String text, long style) {
            super(text, style | Field.FOCUSABLE | LabelField.ELLIPSIS);
    
            setPadding(10, 0, 10, 5);
    
            setFont(Font.getDefault().derive(Font.BOLD,
                    Constants.DEFAULT_FONT_SIZE, Ui.UNITS_pt));
    
            setBackground(BackgroundFactory.createLinearGradientBackground(
                    0x163d7c, 0x163d7c, 0x03162d, 0x03162d));
            setBorder(BorderFactory
                    .createBevelBorder(new XYEdges(1, 1, 1, 1), new XYEdges(
                            Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK),
                            new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK,
                                    Color.BLACK)));
    
        }
    
        public int getPreferredWidth() {
            return Display.getWidth() / 3;
        }
    
        protected void paint(Graphics graphics) {
            graphics.setColor(Color.WHITE);
            super.paint(graphics);
        }
    
        protected void drawFocus(Graphics graphics, boolean on) {
            // Do nothing
        }
    
        protected boolean navigationClick(int status, int time) {
            fieldChangeNotify(1);
            return true;
        }
    
        protected void onFocus(int direction) {
            if (!highlighted) {
                setBackground(BackgroundFactory.createLinearGradientBackground(
                        0x4bb7df, 0x4bb7df, 0x1b96da, 0x1b96da));
                setBorder(BorderFactory.createBevelBorder(new XYEdges(1, 1, 1, 1),
                        new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK,
                                Color.BLACK), new XYEdges(Color.BLACK, Color.BLACK,
                                Color.BLACK, Color.BLACK)));
            }
        }
    
        protected void onUnfocus() {
            if (!highlighted) {
                setBackground(BackgroundFactory.createLinearGradientBackground(
                        0x163d7c, 0x163d7c, 0x03162d, 0x03162d));
                setBorder(BorderFactory.createBevelBorder(new XYEdges(1, 1, 1, 1),
                        new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK,
                                Color.BLACK), new XYEdges(Color.BLACK, Color.BLACK,
                                Color.BLACK, Color.BLACK)));
            }
        }
    
        public void showHighlighted(boolean focus) {
            if (focus) {
                highlighted = true;
                setBackground(BackgroundFactory.createLinearGradientBackground(
                        0x4bb7df, 0x4bb7df, 0x1b96da, 0x1b96da));
                setBorder(BorderFactory.createBevelBorder(new XYEdges(1, 1, 1, 1),
                        new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK,
                                Color.BLACK), new XYEdges(Color.BLACK, Color.BLACK,
                                Color.BLACK, Color.BLACK)));
            } else {
                highlighted = false;
                setBackground(BackgroundFactory.createLinearGradientBackground(
                        0x163d7c, 0x163d7c, 0x03162d, 0x03162d));
                setBorder(BorderFactory.createBevelBorder(new XYEdges(1, 1, 1, 1),
                        new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK,
                                Color.BLACK), new XYEdges(Color.BLACK, Color.BLACK,
                                Color.BLACK, Color.BLACK)));
            }
            invalidate();
        }
    
        public boolean isHighlighted() {
            return highlighted;
        }
    
    }
    

    behrk2 wrote:

    Now, I'm not sure why customButton.setText (calling) would trigger the fieldChanged().  Can anyone think of a reason why he can do?

    Thank you!

    Can you think of a reason why we can't do that? The field has changed, after all! Of course, the context (second argument to fieldChanged) will be PROGRAMMATIC in this case, that might be a pretty good indication for you. But not invoke fieldChanged at all would be wrong.

    This is why I don't like the idea of extending LabelField and not just the field for your custom badges - you have much less control over his behavior. If you want an example showing how to create abstract off-screen buttons, take a look at BaseButtonField and his descendants in managers, fields and advanced buttons.

  • How can I change the height of a button in QML

    Photo we can see, the 'equal' button could not fill the empty space below,

    in the code, I already have the three right-click in a container and the value

    layoutProperties: {StackLayoutProperties}

    spaceQuota: 1

    }

    for the key 'c' and 'back' button, so the game

    layoutProperties: {StackLayoutProperties}

    spaceQuota: 2

    }

    on the button "=", but it did not work.

    But the "zero" button can work well.

    I want to know

    1. How can I set the button to fill the empty space below.

    2. How can I make the size of equal with all the buttons it y width, in other Word, do all the buttons highest.

    Thank you very muck.

    I don't think you can, you'll have to do a custom for her button

    Container {
        id: customButton
        property alias text: label.text
        property alias btnDefault: ib.defaultImageSource
        property alias btnDisabled: ib.disabledImageSource
        property alias btnPressed: ib.pressedImageSource
        signal clicked();
        layout: DockLayout {
    
        }
        leftMargin: 20
        rightMargin: 20
    
        ImageButton {
            id: ib
            defaultImageSource: "asset:///images/copybuttonbackground.amd"
            horizontalAlignment: HorizontalAlignment.Fill
            verticalAlignment: VerticalAlignment.Fill
            onClicked: {
                copyButton.clicked(); //to send signal out
            }
        }
    
        Label {
            id: label
            text: "Original"
            horizontalAlignment: HorizontalAlignment.Center
            verticalAlignment: VerticalAlignment.Center
            overlapTouchPolicy: OverlapTouchPolicy.Allow //sends click to ImageButton
        }
    }
    
  • Problem with the key... Button does not

    My workflow is like this... I took three HoriZontalManager an organization theBackgroundImage the button and two HoriZontalManager to the CustomButton and I am adding the main hfm who hold the button and the background image at the top and then I added the list in a VerticalfieldManager but I don't get the button work the focus always remains in the field list. Now when I click on the update button always resides on the first line of the field list , so it always shows me the selector which is actually I set up on the first line of listfield. How can I solve this...

    Thanks in advance...

    Help, please.

    Solved the problem, I had to check that if the button has the focus, then do the work remains the Listfield has focus. So just check

    In the {navigationClick (int hour, int status)

    {if (Button.isFocus ())}

    Get the job done

    } else {}

    Field list is selected

    }

    }

    Thank you all for your concerns...

  • ERROR: UIObjectPrivate::notifyMessage: unable to set the property

    I get this error now in the console (by pulling down the menu definition) after the addition of the ActionItem and this error (at the outbreak of the ActionItem to show this SystemDialog)

    Everything seems to work properly on the device, the icon image and everything.

    I have another menu ActionItems he never says this error before adding this ActionItem and I another SystemDialog that he never shows this error for.

    I was wondering what it could mean

    Thank you

    ActionItem {

    ID: reset

    imageSource: "icons/ic_clear_list.png.

    Title: qsTr ("Reset")

    onTriggered: {}

    resetPrompt.show)

    }

    }

    And the dialog box

    SystemDialog {

    ID: resetPrompt

    body: qsTr ("what you would like to reset?")

    confirmButton.label: qsTr ("whole table")

    customButton.label: qsTr ("cell widths only")

    onFinished: {}

    If (result is SystemUiResult.ConfirmButtonSelection)

    {

    resetWarning.show)

    } Else if (result == SystemUiResult.CustomButtonSelection)

    {

    app.resetCellWidths)

    }

    }

    }

    ignore it. It's just a warning in the console.

  • Field bitmap button

    Hello...

    Yes, I looked in other posts.  And trying to disect the sample APP CustomButton.  But, the image does not change the focus for this, and really, I had a hard time to work with it.

    So, after several hours, I write...

    I would like to make my button below clickable so that it plays a sound image and changes on focus.  However, I have not yet found a strategy that I could implement.

    Can someone provide some guidance?  The error that I get with the implementation ŒUVRE FieldChangeListener when I try to extend the UiApplication is that...

    ....... The SmartCord type must implement the inherited abstract method FieldChangeListener.fieldChanged (field, int)

    So clearly something is wrong and I have a bad strategy, but I have no idea what.

    I use absolute available to resize the image according to the size of the screen

    Thanks for the tips...

    package com.package;
    
    import net.rim.device.api.ui.*;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.container.*;
    import net.rim.device.api.system.*;
    
    /**
     * This class extends the UiApplication class, providing a
     * graphical user interface.
     */
    
    public class MyApp extends UiApplication implements FieldChangeListener
    {
    
        public static void main(String[] args)
        {
                MyApp theApp = new MyApp();
                theApp.enterEventDispatcher();
        }
    
        public MyApp()
        {
            MainScreen mainScreen = new MainScreen();
            AbsoluteFieldManager MainFieldManager = new AbsoluteFieldManager(){
    
                //Size the Field to the Screen Size
    
                protected void sublayout( int maxWidth, int maxHeight)
                {
                int width = Display.getWidth();
                int height = Display.getHeight();
                super.sublayout( width, height);
                setExtent( width, height);
                     }
    
                //Override the paint method to draw the background image.
    
                public void paint(Graphics graphics)
                {
                    Bitmap background = Bitmap.getBitmapResource("background.png");
                    Bitmap backgroundscaled = new Bitmap(Display.getWidth(),Display.getHeight());
                    backgroundscaled = new Bitmap(Display.getWidth(),Display.getHeight());
                    background.scaleInto(backgroundscaled, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FILL);                                   
    
                    //Draw the background image and then call paint.
    
                    graphics.drawBitmap(0, 0, Display.getWidth(), Display.getHeight(), backgroundscaled, 0, 0);
                    super.paint(graphics);
                }
            };                        
    
            //Power Button 
    
            Bitmap powerbutton = Bitmap.getBitmapResource("blackbutton.png");
            Bitmap whitepowerbutton = Bitmap.getBitmapResource("whitebutton.png");
            Bitmap powerscaled = new Bitmap(Display.getWidth()/2,Display.getWidth()/2);
            powerscaled = new Bitmap(Display.getWidth()/2,Display.getWidth()/2);
            Bitmap powerpressedscaled = new Bitmap(Display.getWidth()/2,Display.getWidth()/2);
            powerpressedscaled = new Bitmap(Display.getWidth()/2,Display.getWidth()/2);
            powerbutton.scaleInto(powerscaled, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FILL);
            whitepowerbutton.scaleInto(powerpressedscaled, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FILL);
            BitmapField bitmapField2 = new BitmapField(powerscaled, Field.FOCUSABLE) ;
            //Location
            int field2x=Display.getWidth()/4;
            int field2y=(Display.getHeight()/2)-(Display.getWidth()/4);   
    
            //Add the manager to the screen.
    
            mainScreen.add(MainFieldManager);
    
            //Add the fields to the manager.
    
            MainFieldManager.add(bitmapField2,field2x,field2y);            
    
            //Push the screen.
    
            pushScreen(mainScreen);
        }
    }
    

    Thanks for the reply.

    Yes, I am just now simply show the domains I've created for the package which is currently running and which displays some things I'd like to that.

    So my queestion is, what do you suggest to be the next?  I feel that I need to have separate classes for each button, which extends to a BitmapField?  I left it because I didn't know how to add.

    Thank you

  • Strange behavior in QML

    I have a strange problem with a QML file. My first level NavigationPane has an attached SystemDialog:

    attachedObjects: [
        SystemDialog {
            id: confirmCancelDialog
            title: qsTr("Confirm")
            body: qsTr("There are unsaved changes.")
            confirmButton.label: qsTr("Discard and Close")
            cancelButton.label: qsTr("Abort... Don't Close")
            customButton.label: qsTr("Save... Then Close")
        }
    ]
    

    The Page just under the NavigationPane has an action of "Cancel". This code works fine:

    ActionItem {
        title: qsTr("Cancel")
        ActionBar.placement: ActionBarPlacement.OnBar
        imageSource: "asset:///images/ic_cancel.png"
        onTriggered: {
            var result;
            if (settingsNavPane.dirty) {
                confirmCancelDialog.exec()
                result = confirmCancelDialog.result
            } else {
                result = 2;
            }
            if (result == 2) {
                // ---Force FeedDetailsEdit page to reload values next time
                feedDetailsEdit.feedEdit = null;
                scrollView.scrollToPoint(0, 0);
                parentSheet.close();
            } else if (result == 6) {
                // ---Save then close
                saveAndClose();
            }
        }
    }
    

    Even if I use two statements if() here to test if the 'result' is 2 or 6, my usual practice would be to use one instead:

    ActionItem {
        title: qsTr("Cancel")
        ActionBar.placement: ActionBarPlacement.OnBar
        imageSource: "asset:///images/ic_cancel.png"
        onTriggered: {
            var result;
            if (settingsNavPane.dirty) {
                confirmCancelDialog.exec()
                result = confirmCancelDialog.result
            } else {
                result = 2;
            }
            switch(result)
            {
                case 2:
                    // ---Force FeedDetailsEdit page to reload values next time
                    feedDetailsEdit.feedEdit = null;
                    scrollView.scrollToPoint(0, 0);
                    parentSheet.close();
                    break;
                case 6:
                    // ---Save then close
                    saveAndClose();
                    break;
            }
        }
    }
    

    .. .but it does not work. When result == 2 switch correctly gives control to the "box 2: ' block, but the 'feedDetailsEdit.feedEdit = null;' statement never returns, and the rest of the cases never block runs, so does not close the page. Normally when I encounter a statement that behaves in this way, it is because there is a syntax error that is not taken at the time of the design, as an unitialized variable or object, for example, but in this case the exact same block of code works fine when in an if-else block, but not in a switch case block.

    The code also works very well if I'm hard on the conditions surrounding the fault block completely:

    ActionItem {
        title: qsTr("Cancel")
        ActionBar.placement: ActionBarPlacement.OnBar
        imageSource: "asset:///images/ic_cancel.png"
        onTriggered: {
            var result;
            if (settingsNavPane.dirty) {
                confirmCancelDialog.exec()
                result = confirmCancelDialog.result
            } else {
                result = 2;
            }
            // ---Force FeedDetailsEdit page to reload values next time
            feedDetailsEdit.feedEdit = null;
            scrollView.scrollToPoint(0, 0);
            parentSheet.close();
        }
    }
    

    25 years of professional business development experience with many languages such as C/C++ and JavaScript, but this one I left me speechless. Why the variation that does not work?

    Maybe it's this bug in Qt, which cannot have been fixed yet? https://bugreports.Qt-project.org/browse/QTBUG-17012

    (If this is the case, apparently adding braces around the code in each case individual would work around the issue. Maybe try it.)

  • change the bitmap button

    Hello everyone

    I have a button called cbutton customfield.
    I want to show him different text whenever I click on it. (For example a - z). But when I try
    CButton = new custombutton (alpha);
    It doesn't seem to work.
    Help, please

    you could substitute navigationclick and navigationunclick, set a Boolean condition in there and the call was canceled.
    in the paint method you find isClicked (your custom status) and paint something else, like the second bitmap, for example.

  • Looking for a little nudge in the right direction

    Hey guys,.

    I am bashing as a result of my first BB app and seem to have a little problem, my app is basically pulling in a workflow items that I'm out like CustomButtons my problem is that these dynamics xml and variable amount

    For my hard-coded buttons, I have a set of changeListner that allows me to push my new screen and what not, but how to implement something similar for my dynamic buttons? All the examples I found on the web are just hard coded keys that are not good for me .

    If someone gets my message in a bottle and then all counseling will be more appreciated.

    Thank you

    Thanks for the help of Simon, in fact, I got a cup of coffee and woke up I wasn't implemented my code in "navigationClick" isn't that what I just called my shock and a little bit and we're back on cool runnings.

    protected boolean navigationClick(int status, int time)
        {
            Article loadFeed = new Article("News and Analysis", 0x0094CD, label, Desc);
            UiApplication.getUiApplication().pushScreen(loadFeed);
    
            return super.navigationClick(status, time);
        }
    
  • Question of width for HorizontalFieldManager nin BB OS 6.0 and 7.0

    Hi all

    I developed a new application for BB OS 5.0, 6.0 and 7.0, which in its homepage has a bar containing different categories of navigation. The navigation bar is designed as:

    public HeaderMenu (String [] categories, HeaderMenuListener listCallback) {}
    Super(NO_HORIZONTAL_SCROLL |) NO_HORIZONTAL_SCROLLBAR | FOCUSABLE);
            
    mCategories = categories;
    mNewsListCallback = listCallback;
    mButtons = new CustomButton [mCategories.length];
    noOfCategories = mCategories.length;
    ND = this;
            
    mCategoryNavigator = new HorizontalFieldManager(FOCUSABLE |) HORIZONTAL_SCROLL |       HORIZONTAL_SCROLLBAR) {}

    public int getPreferredWidth() {}
    If (noOfCategories > 1) {}
    navigatorWidth = Display.getWidth () - mLeftNavigator.getWidth () - mRightNavigator.getWidth ();
    return Display.getWidth () - mLeftNavigator.getWidth () - mRightNavigator.getWidth ();
    }
    else {}
    Return Display.getWidth ();
    }
    };
                
    protected void sublayout (int maxWidth, maxHeight int) {}
    Super.sublayout (maxWidth, maxHeight);
    setExtent (getPreferredWidth (), getPreferredHeight());
    };
                
    };
    loadCategoryView();

    mLeftNavigator = new BitmapField (AppResolutionVariables.mLeftNavigationBtn, NON_FOCUSABLE);
    mRightNavigator = new BitmapField (AppResolutionVariables.mRightNavigationBtn, NON_FOCUSABLE);

    If (noOfCategories > 1)
    {
    Add (mLeftNavigator);
    }
    Add (mCategoryNavigator);
    If (noOfCategories > 1)
    {
    Add (mRightNavigator);
    }
    this.setBackground (BackgroundFactory.createSolidBackground (COLOR_MAROON));
    }
        
    /**
    The method of loading of new categories in a scroll handler.
    */
    private void loadCategoryView() {}
            
    int size = mCategories.length;
            
    Added table of buttons representative of the new categories to the Manager of scrolling.
    for (int i = 0; i)<>
    String categoryName = mCategories [i];
    mButtons [i] = new CustomButton (categoryName, DATA_FONT_BOLD, DATA_FONT_PLAIN,
    COLOR_MAROON, COLOR_WHITE) {}
                    
    public int getPreferredHeight() {}
    Return AppResolutionVariables.mLeftNavigationBtn.getHeight ();
    };
                    
    protected boolean navigationClick (int status, int time) {}
    int index = Arrays.getIndex (mButtons, this);
    If (index > = 0) {}
    mNewsListCallback.notifyHeaderButtonClick (index);
    }
    Returns true;
    }
    };
    mCategoryNavigator.add (mButtons [i]);
    }
    }

    Method takes care of asking left and right navigation buttons and scrollable Manager in the correct position.
    protected void sublayout (int maxWidth, maxHeight int) {}
            
    Super.sublayout (maxWidth, maxHeight);
    setExtent (getPreferredWidth (), getPreferredHeight());
            
    If (noOfCategories > 1) {}
    layoutChild (mLeftNavigator, maxWidth, maxHeight);
    setPositionChild (mLeftNavigator, 0, 0);
    }
            
    layoutChild (mCategoryNavigator, maxWidth, maxHeight);
    If (noOfCategories > 1) {}
    setPositionChild (mCategoryNavigator, mLeftNavigator.getWidth (), 0);
    } else {}
    setPositionChild (mCategoryNavigator, 15, 0);
    }
            
    If (noOfCategories > 1) {}
    layoutChild (mRightNavigator, maxWidth, maxHeight);
    setPositionChild (mRightNavigator, getPreferredWidth() - mRightNavigator.getWidth (), 0);
    }
    }

    The question do face is, when I scroll horizontally to the last button at the side bar, the last button is not visible completely, it becomes hidden by the right navigation button on the far right of HFM. This issue is in OS 6.0 and 7.0, but not in OS 5.0.

    Earlier, I had the problem in OS 5.0 so to fix it, I prevail on HFM getPreferredWidth() scrolling above, to return the width (width width HFM - width of navigation left button - not with the right navigation button scrolling) and it works fine. Can someone please fix the problem. Thanks in advance.

    Sorry just looking quickly here.

    The question which I believe is in your sublayout.  You tell your mCategoryNavigator field is the maximum width.  This isn't.  There only the width rest once the buttons have been added.

    There are two ways you can solve the problem.

    The simple way is just to spend the maximum width in the super.sublayout for mCategoryNavigator and no maxWidth.

    But the best way is to remove this sublayout completely and in your sublayout for the Manager.  In this handler, the layout and position your two buttons, then give the drop-down field which remains as its maximum width.

    Two other comments:

    (a) I would like to forget calling super.layout in your HeaderMenu and make everything in your own sublayout.  It would be a good exercise.  Remember the last thing you do is a setExtent, once you have placed all and so that you know how much space you need.

    (b) If you never call super.layout and then do a setExtent to get the correct size, the alarm should sound.  It's a bit like someone who gives a piece of paper, asking them to draw a picture and then decide that in fact the piece of paper is a different size of paper, that they needed to make the drawing.  You are actually asking someone else to do something and then ignoring what they have done (or at least a part of it).  If you find that you need to do, then look for another way as setExtent substitution causes the sorts of problems you found.

  • Disableing a field

    Is it possible to disable a field so that it cannot be edited or concentrate? I tried setVisualState (ButtonField.VISUAL_STATE_NORMAL) for a few buttons I have, but they are only temporarily disabled (or at least look disabled).

    Hi rcmaniac25,

    Sorry I copied the (false) setFocusabled of my class CustomButton. This is not present in the api.

    You can try with this:

    ButtonField btn = new ButtonField ("Button", Field.NON_FOCUSABLE);

    and do not add any listener in the field

    btn.setChangeListener (this);

Maybe you are looking for

  • MFP HP LaserJet Pro 400 M425dn cold reset

    Hello! Help me! How can I make cold reset HP LaserJet Pro 400 MFP M425dn ?

  • What is MegaBackup?  He continues to display on my desktop.

    MegaBackup keeps popping up on my desk last week.  What is it?  I am told to release the new version.

  • Photosmart 6380 turns off

    Hi, I have a Photosmart 6380, whenever I turn it on, I am prompted to run cartridge alignment function, which never fixes the problem. When I try and print the printer turns off after about 2/3 draws and asks me to restart the printer. It is really a

  • Can scan but not print wireless

    HP Deskjet 3050 j610 printer all in one I have two PCs running Windows 7 Ultimate 64 bit, and Windows 7 Home Premium 32 bit on a network home. The Home Premium pc is connected via a USB cable and prints and scans OK. The ultimate is wifi and scan OK,

  • pixelated break after installation of el capitan

    Just upgraded to El Capitan.  Timeline plays very well, but when I break video becomes scratched, eyes yellow and red.  Seems to be a recent bug.  I'm on an iMac