Digole
Digital Solutions
iDigole Buyer ProtectioniDigole Buyer
Protection
My shopping cart
0 Items:
Secure Checkout
Top Rated Plus
Visit Our Live Auctions
99.9% Customer's Satisfaction
 
Forum : Digole Serial Display :

 Search Forum.. 
 Creat New Topic   Reply 

Create Button with text

Hi any idea how to make buttons on touch display with text values on the button? I neet to draw 8 buttons with temerature and the buttons will switch on / off relay by Artuino.

I draw the filled drawBow() but text is not centred on the button.

thank you for any idea

Vaclav

 

RE:Create Button with text

 What I normally do is I use custom fonts that I know the exact widths of all the characters. I keep a data structure of character font width and have a function that takes a string and will return the number of pixels that string will take. I use that value, with some simple median math to figure out how to place it if I want it centered. i.e. Get the width in pixels, divide by two, then subtract that from the center X position of your button. The result of this calculation would be the X position to draw your string.

 

Copyright Digole Digital Solutions, 2008-2017. All rights reserved.
Powered by Victor Sun