height


Re-size the Text and Button/Label in Livecode


I have a livecode project with a button and a label. I want the width and height of the button and label changes when I re-size the window(stack). Also, I want the font size of the text in the label and button to change. I want to center the horizontal and vertical alignment of the text as the font size changes. I tried this code but the text exceeds the height of button/label (in bigger window size).
set the width of field "label" to the width of this stack * 0.8
set the height of field "label" to the height of this stack * 0.2
set the textsize of field "label" to the height of field "label" - 10
set the textheight of field "label" to the height of field "label"
This is what I'm expecting...
How can I achieve this?
The problem of smoothly resizing text as you resize the stack window is a tricky one. Here is a solution that may not be perfect, but it gets you close. The field has dontWrap set to true and margins set to 2. I also set an initial textFont and textSize for the field, so it's not just using an inherited textFont.
This handler is in the script of the card the field is on.
on resizeStack pNewWidth, pNewHeight
set the width of field "label" to pNewWidth * 0.8
set the height of field "label" to pNewHeight * 0.2
set the topLeft of fld "label" to pNewWidth * 0.1, pNewHeight * 0.1
lock screen
if the formattedWidth of fld "label" > the width of fld "label" OR \
the formattedHeight of fld "label" > the height of fld "label" then
set the textSize of field "label" to the textSize of fld "label" - 1
else if the formattedWidth of fld "label" < the width of fld "label" OR \
the formattedHeight of fld "label" < the height of fld "label" then
set the textSize of field "label" to the textSize of fld "label" + 1
end if
unlock screen
end resizeStack

Related Links

How to set the detail height programatically in ActiveReports
Looking for a way to change the fixed height of page header in Access 2007
CSS Background image not showing with height auto
Binary Tree find height of a specific Node
Re-size the Text and Button/Label in Livecode
Overlay a background image onto the web page
WooCommerce - change price based on product_id, width and height
Susy gallery breaks height for display table and table-cell
Flex Slider full height and width without stretching
mPDF set Height for SetHTMLHeader
How to Set Height of PdfPTable in iTextSharp
Margin not showing with 100% width & height
KO Grid Scrollbars not visible & Display issues
Increase scrollview's element height on clicking it
Using soft keyboard on libgdx for iOS and Android (hides textview)
Fine-uploader - Scaling picture by height

Categories

HOME
arrays
paypal
sas
sidekiq
sass
vhdl
facebook-graph-api
youtube-livestreaming-api
reportportal
d
actionscript
playframework
mainframe
automated-tests
safari
orientation
value
vsftpd
proguard
finite-group-theory
cosmicmind
arm-template
tree-traversal
device-detection
excel-2010
scalaz7
delete-file
switching
skmaps
blackboard
expand
skygear
pyscripter
mapguide
wfp
installshield-2012
android-preferences
cgo
constants
drawingarea
goquery
applepayjs
azureportal
xmgrace
maintenance
jszip
lotus
spring-ioc
manifest.mf
pax-web
spatial-query
test-class
difference
anythingslider
wikitext
app.xaml
evo
qbfc
sevenzipsharp
base32
ffserver
debian-based
pgm
custom-url
robocode
django-1.6
and-operator
ibmsbt
fragment-tab-host
em
docopt
outline
method-overriding
ember-addon
internal
healthvault
sqljdbc
installshield-2009
justgage
vertical-scrolling
arbor.js
pstree
redirectstandardoutput
subtract
die
visual-web-gui
msgbox
selectonemenu
selectmanycheckbox
datacontract
goliath
rubycas
noir
audiostreamer
delegatecommand
boost-date-time
swfloader
usability-testing
act
hmacsha1
visual-studio-dbpro
document-library

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App