Digole
©DIGITAL
SOLUTIONS

Serial Display emulator    New Display User manual

Forum login or
Login:
Password:
  
Forum Catagory
Digole Serial Display (215)
  12864 LCD/OLED module (24)
  24064 LCD module (3)
  Color LCD Modules (29)
  Color OLED module (21)
  Online Emulater (5)
  Universal GLCD module (1)
  Universal Text LCD module (2)
Mini Display Panels (0)
  Mini LCDs (0)
  Mini OLEDs (0)
Pattern Drive Module (0)
~Buy & Sell on Digole (2)
~Others~ (5)
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/Digole Technologies Inc., 2008-2026. All rights reserved.
Powered by Digole