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;

Tags: BlackBerry Developers

Similar Questions

  • I have a button with the icon text. Is it possible to increase the space between the text and icon?

    Mr President.

    I have a button with the icon text. Is it possible to increase the space between the text and icon?

    adf button text image space.png

    adf button text image space.jpg

    Concerning

    Have you tried it as directed by the other thread?

    
    

    See you soon

    AJ

  • By clicking with the right button on something, I accidentally stuck the pictures on a website - I want them back, but may not know how to do

    By clicking with the right button on something, I accidentally blocked the photos to a Web site - want their return but may not know how to do

    This has happened

    Don't know how many times

    == I right click on the images of block a site or something like that.

    Check the image exceptions: Tools > Options > content: Load Images: Exceptions - see the web content, pop-ups, fonts and language settings

    A way to see what images are blocked is to click on the favicon (Site ID icon) on the left side of the address bar and click the button "additional information".
    This will open the Security tab of the window of the Information Page (also accessible via Tools > Page Info).
    Go to the Media of this Page Info window tab.
    Select the first image and scroll though the list with the arrow pointing downwards.
    If an image in the list is grayed out and there is a check mark in the box of block Images of... remove this brand in order to unlock the images from this area.

    See also the problems that cause to not show images and http://kb.mozillazine.org/Images_or_animations_do_not_load

  • When I click with the right button of the mouse on videos from facebook it shows no options for me to copy the link and etc.

    When I click with the right button of the mouse on videos from facebook it shows no options for me to copy the link and etc. It only shows the parameters for the flash player. How can I fix?

    You can find the URL of the thumbnail by following these steps:
    In the context menu, choose {inspect element}.
    Now, you can see the URL in the source down (perhaps you click the small arrow to the left of the line of seledted firstly to show).

  • Moving the tabs with the left button of the mouse no longer works! Help please!

    Well, since today, when I try to move/rearrange my tabs on the tab bar, the 'move' tab to copy! So instead of moving, I add another tab with the same Web page. Also I can't add tab for the bookmarks bar or by dragging with the left button of the mouse on it.

    I even tried restarting my computer, my firefox nightly and even rebooted in safe mode. Oh and I have the latest update. If someone has an idea?

    Well after that the next update on every night, the problem has been fixed.

  • Update Firefox 29 I can't access to the sidebar of history with the history button. Any suggestions on how to change this? I tried to customize the toolbar

    Since the last update I can not access the sidebar of history with the history button more. I tried to customize the toolbar and download the Restorer Classic theme. Neither worked help would be appreciated.

    Does it mean that nothing happens when you click the history button and choose View history Sidebar?

    And nothing happens when you click the taskbar button side story provided by classic restaurateur theme?

    What happens when you hold the Ctrl key and press H?

    If none of the works above, restart Firefox with disabled modules and test again. Of course the button provided by the Restorer of classic theme will be temporarily unavailable.

  • the camera shutter sound cannot be silent with the mute button on my phone i 6 s

    the camera shutter sound cannot be silent with the mute button on my phone i 6 s

    Depending on where you purchased your phone, this is not possible, because of legislation in these countries that regulate this feature.

    In all other cases, try to force reboot the phone by holding down the button sleep and home for 10 seconds, until the Apple logo comes back again. You won't lose data, but it can cure some problems after installing new software or applications.

    In the case where this does not work, restore the phone:

    Use iTunes to restore your device iOS to factory settings

  • Firefox v15 and up to cause my computer (MAC OSX 10.8.2) to freeze for about 30 seconds every 15 to 30 seconds and I have to turn it off with the power button

    Firefox v15 and up to cause my computer (MAC OSX 10.8.2) to freeze for about 30 seconds every 15 to 30 seconds and I have to turn it off with the power button. It this causes only after I opened Firefox, my computer works well before the opening of Firefox. I h

    It looks a little like yo maybe has a hardware problem on your computer. have you tried to repair permissions on your hard drive? create a new Firefox profile? Use the Profile Manager to create and delete profiles Firefox

  • Is it possible to connect my Application ' Stop' button with the "Run" button of LabVIEW?

    Problem - one of my clients recently tested my new LabVIEW application and asked how the arrested LabVIEW application can be restarted without clicking on the "Run" (right arrow) button.

    Is possible solution - possible to connect my Application ' Stop' button with the "Run" button of LabVIEW?

    Thank you!

    Barry

    The big problem is in your Acquistion to stop audio event. You run the LabVIEW stop sign which is the equivalent of hitting the Cancel button in the toolbar.  (See contextual help on that).  You can stop the acquisition, but you don't want to stop your LabVIEW program.  You need this case in the event your computer to transition state in a sleep mode when you do not make any purchase.  Then hit the purchase button to start again transitions the machine state in the acquisition.

    In your case of program output, you want really to leave LabVIEW it.  You want to run and stop commands like closing the com port and one of these activeX references.  Then allow it to stop the while loop.  Turn the LabVIEW out outside the loop so that once everything is cleaned, your application may close.  You probably want to wrap this command in a case structure so that if you are in the execution environment, it leaves your application.  But if you are in the development environment, you don't want to cause your LabVIEW environment stop.  Another thing is that right now, you actually have a race condition in the Exit event.  The com port will close first or LabVIEW will come out.  There is no defined order of execution.

    Alternatively, you can have an event to close panel? in this way, you haven't accidentally short circuit all your program by pressing the X key.  You want to capture this event, discard it.  And if you want to not actually closed, did trigger the Exit Program button so that you can gracefully shutdown.

  • XP home sp3 can use printer/sp2 vista home premium & files on a network private wireless, but not vice versa. Vista can see xp connected on the entire map, but can not do anything with the icon

    someone on this planet knows!

    XP home sp3 can use printer/sp2 vista home premium & files on a network private wireless, but not vice versa. Vista can see xp connected on the entire map, but can not do anything with the icon (it shows the IP etc. When hovered over with the mouse). tried fix & checked all the rest including the settings found on the masses of internet sites. don't think that this problem is so widespread and not final fix?. someone must know the answer. both computers have norton 360 v6. !. two computers use internet very well through the same network switch. two computers worked flawlessly again, no repairs, no reinstall, not zero other problems ever (always ran 360 and first market backup battery).

    Hello
    I recommend that you search/post this question on the link below:
    http://social.technet.Microsoft.com/search/en-us/?query=networking%20with%20Vista&refinement=112&AC=1
    b Eddie

  • When the Admin sign on the office comes to the top, but after that the computer does not respond when the user tries to do anything. There are actually turns off the computer with the power button.

    Original title: user profile

    My administrator user profile does not work properly, but I have a user profile that has activated the parental control that worked well for about a year and yesterday when this user logs on the desktop comes up, but after that the computer does not respond when that user tries to do anything. There are actually turns off the computer with the power button.  I ran a virus scan and spyware scan in my user admin profile and he has not found anything.  I don't know what to check.

    Hello rhunter15,

    There may be a program to interfere with Parental controls so that we can try a few things to see if we can determine the application or program that is causing problems.

    First of all, we run System File Checker to see if you have a corrupt file system.

    • Click Start
    • Click on all programs
    • Click Accessories, and then right-click on the command prompt.
    • Select the Security tab and choose "Run as Administrator"
    • Click on command prompt
    • Type SFC/scannow.

    It will scan and repair any damaged operating system files.

    To determine if there is a program because of a conflict, we recommend that you perform a "clean boot" of the computer. A clean boot is designed to disable programs and services in the background as much as possible. This helps determine which service or program can be the cause of the problem.  For more information about how to perform a clean boot for troubleshooting, click the number below to view the article in the Microsoft Knowledge Base.

    KB 929135 - how to solve a problem of performaing a clean boot in Windows Vista.
    http://support.Microsoft.com/kb/929135

    Once you have finished the clean boot, check again and see if you get the error of parental control.

    If please post again and let us know if that helped pinpoint the problem or if you still need help.

    Thank you

    Marilyn
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Click with the right button on failure

    Im trying to run programs as administrator.when I click with the right button on the laptop keys or mouse nothing happens.no list, nothing.like its been completely disabled. IM the only user and admin. The only changes ive done what anyone recently had to add ad blockers/cookie self destruct in the browser and customize the start menu... I took the children by clicking on the wallpaper, but do not know if one who has nothing to do with the problem.im not a user too experienced if there is no simple solution out there, then they would be greatly appreciated...  Thank you *.

    Sorry for the words... I left out by pressing the touchpad keys and went with a right-click to cover the two pad and mouse.i wouldn't seem redundant or on foot. the problem is now resolved, although I feel stupid.apparently children jumped a square card of DELL on the out front (do not know what as for) but looks like a giant SD card. When I found it and put back in, the right click function has started working again... Thanks for all the replies... tho im still learn and have no doubt that I'll be here again questions...

  • I'm looking to have an input field with the search button, search button click the search button below the search results to display. How can I do?

    I'm looking to have an input field with the search button, search button click the search button below the search results to display. How can I do?

    Hello

    998765 wrote:

    You are right

    Please pass by the database 2 day + Application Express Developer's Guide

    Check this code example

    1 create a text field element I say P1_INPUT_FIELD

    2. create a button

    Name of the button: search

    Action: Send the page

    3. change your report query and where clause to your query below

    It will search on ename and empno, in this way, you can add more columns

    SELECT EMPNO
               , ENAME
               , SAL
               , MGR
               , COMM
      FROM EMP
    WHERE TRIM(UPPER(ENAME)) like '%' || TRIM(UPPER(:P1_INPUT_FIELD)) || '%'
           OR TRIM(UPPER(EMPNO)) like '%' || TRIM(UPPER(:P1_INPUT_FIELD)) || '%'
    

    4. we find the source of the region-> page article to submit-> P1_INPUT_FIELD

    Hope this helps you,

    Kind regards

    Jitendra

  • Danielle Beaumont has been a mobile video ' Design is fun! You want to bring up the menu even inside the accordion for the navigation panel. There are no on which left aside, as the way in which it has been triggered open with the icon. how he was placed

    1 Danielle Beaumont has been a mobile video ' Design is fun! You want to bring up the menu even inside the accordion for my own mobile navigation panel. He's left no aside, the way it has been triggered open with the icon; how he was placed to bump at the gap when selected via the icon; how it was considered first of all just a big green square; How the link boxes were made to be spaced as if they were... Can you direct me how to create it?

    2. also in trouble with the specification of fonts. There are times that I can choose a font from the list, I chose the additional fonts available and sometimes, when it just won't let me choose one, even if it is already used on the site or page.

    On a steep curve here, but any new information provide from my recent contact with Adobe has been extremely useful. My site is www.curricula101.com. It is much better than what it was when I called first a few days ago. Sales pages work fine now, thanks to your contribution.

    3. on the navigation path revised: a current question is menus horizontal separated for the GMAT and GRE goes everywhere at the top and bottom of the pages. I've specified particular States for text via the Site Properties > content > hyperlink styes on the default style. A bright color is chosen for the active state, but he does not like such (not at all). The other menu (home, Contact, schools etc.) made by the widget Menu runs perfectly until white color shows in the current page instance.

    There are a lot more refinement and content development to do for sales purposes.

    Thank you for your help.

    Best wishes to all at Adobe,

    Elleyne Kase

    Hi Elleyne,

    1. I have an article on the creation of an accordion menu on my site which may help. You can read it using the link below.

    How to create an accordion Menu in Adobe Muse | Creative muse

    2. I don't know too much talk of it. When you say additional fonts do you mean web fonts?

    3. see my reply in the thread below.

    Re: Text links not working properly - active or visited says doesn't work do not at all

    I hope this helps.

    David

    Creative muse

  • Why when I click with the left button of the mouse on the unique tool, you open the window with the other instruments?

    When I click with the left button of the mouse on the unique tool, open the window with the other instruments


    Mohito Hi, this morning, I solved the problem by trying to support. I realized that the problem was in mice, because the click rate is at its highest level, and then click the instruments was like if he did 2. I will now set the minimum speed of the clicks.

    Thank you

  • Dynamic array, not filling, works very well with the test button

    I built a recordset object and tested with the Test button and the Recordset returns my data on my remote server.  I then put a dynamic array on my php page that it points to the recordset of this work and that the PivotTable is empty.  The table displayed in design mode correctly with the recordset.vcolname, but when running that data are not to be connected.  I even tried just drag a few pieces of data on and still no data.  Any help would be appreciated.  Have a great day!

    There are a lot of things I want to mention, but do not have the time to.

    I'll start with the fact that you are using soon be deprecated MySQL instead of MySQLi or PDO.

    Second, you can't have your markup in the head section of your document as in

    Third, none of the session variables will not work if you start the session after your conditional statements. In other words, session_start() should be at the top of your document.

    There is more, but lack of time prevents me from analyzing those.

    My advice is to start with my third point, which is to place the session_start() at the beginning of your document and see if that changes things.

Maybe you are looking for

  • Question of Live View EOS 70 d

    Hello I just bought a 70 d EOS.  My question relates using Live View under "auto".  I understand that touch the display screen directly causes the camera to focus about to contact, and that's exactly what's happening on my camera.  However, I also no

  • Help load audio books

    Hi all I'm sure that it took more than 1000 times, but I still do not understand this... What I want to do is to load an audio book, as he will play in the order, i.e. when disk 1 is finished then start playing the disc 2, etc.. I have years of exper

  • Office Jet Pro 8600 can not connect the Web Service server.

    Apparently, I need to enter a proxy address. Where can I find details of proxy? I use Windows 7 and I just installed the printer successfully (wireless) Thanks in advance!

  • WAP11 access - point adjustment will not save

    I'm trying to set up my gateway again after a period of inactivity. I have download the settings to the AP through the USB configuration utility, it says 'DOWNLOAD CONFIG OK' and reflect the setting. Until then goods (specifically I try to activate W

  • removal of windows for new install

    Remember - this is a public forum so never post private information such as numbers of mail or telephone! Ideas: You have problems with programs Error messages Recent changes to your computer What you have already tried to solve the problem