Forum Discussion

mramim's avatar
mramim
Streaming Star
5 years ago

Fixed width-height Scenegraph Button

I want to populate a button with image coming from API, i've set the minWidth and maxWidth to be "64" but whenever I populate the iconUri with image from server, the button just grows in size. How can I prevent this?

    • mramim's avatar
      mramim
      Streaming Star

      Sure, I've a button group that holds multiple buttons with different ids, and they all have a placeholder iconUri and focusedIconUri, my intention is to change these icons with a network Image that I receive from the API(that image is not always 64px)

       

      <ButtonGroup>
      
      ....
      
      <Button id="id1" minWidth="64" maxWidth="64"
      height="64" text=""
      focusBitmapUri="pkg:/images/transparent.9.png"
      focusFootprintBitmapUri="pkg:/images/transparent.9.png"
      iconUri="pkg:/images/2_quality.png"
      focusedIconUri="pkg:/images/2_quality.png" />
      
      ...
      
      </ButtonGroup>



      On the brightscript side of the code, I've a task that loads info from api and then I just try to set the field 

      m.btn1.iconUri = m.top.response.apiImage
      m.btn1.focusedIconUri = m.top.response.apiImage

       

      Let me know if you need any other information.