# Adjust button dimension to text

**URL:** https://forum.kirupa.com/t/adjust-button-dimension-to-text/251876
**Category:** Uncategorized
**Created:** [February 13, 2008, 2:01pm UTC](https://forum.kirupa.com/t/adjust-button-dimension-to-text/251876 "2008-02-13T14:01:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rafnews](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@rafnews](https://forum.kirupa.com/u/rafnews)
#### Post date: [February 13, 2008, 2:01pm UTC](https://forum.kirupa.com/t/adjust-button-dimension-to-text/251876/1 "2008-02-13T14:01:56Z")

</div>

Hi,  
i have a dynamic text field onto which one, i should have a buttonclip.

however, as the text into dynamic field changes size quite often, i would like to automatically adjust the size of button to the dynamic text field.

I’ve tried that :  
mybutton.Height = mytext.height;  
mybutton.Width = mytext.width;  
mybutton.x = mytext.x;  
mybutton.y = mytext.y;

but i does not work well… button does not update to mytext size.  
before i tried :  
mybutton.height = mytext.height;  
mybutton.width = mytext.width;

but in this case, width and height of mybutton = 0;

so any idea ?

thx.
