Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Text help
Author | Message | ||||
lew247 Guru Joined: 23/12/2015 Location: United KingdomPosts: 1702 |
Is it possible to display 2 different things on one line of text with the 2nd starting at the end of the 1st Example Text WIDTH%/2, HEIGHT%/2, dvalue$, CM, 6, 2, dcolour% Text ***Starting at the end of the dvalue$**** dunits$, LB, 2, 2, Rgb(White) I know I could possible do both in the same font and colour as one line but I need both to have different fonts the 1st one is Speed which needs to be big, the 2nd says mph or kph which obviously needs to be smaller I am aware I could position it manually on the screen but when the speeds changes from one digit to two or 3 digits the mph/kph would be in the wrong part of the screen it it would look terrible I'm using an ili9341 2.4inch display This is what I have at the moment dunit$ = either Kph or Mph Text WIDTH%/2, HEIGHT%/2, dvalue$, CM, 6, 2, dcolour% Text 205, 200, dunits$, LB, 3, 1, Rgb(White) Text 40, 240, "Battery " + (Str$(battery!,1,2) + "V"), LB, 3, 1, Rgb(White) Edited 2023-04-30 20:40 by lew247 |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3196 |
Because all the fonts are fixed width you can calculate where the first string ended and then start your new string (with a different font) at that coordinate. However, you could not rely on the TEXT command to centre the whole string. If you want to do that you would need to do your own calculations to centre the whole lot. Geoff Geoff Graham - http://geoffg.net |
||||
lew247 Guru Joined: 23/12/2015 Location: United KingdomPosts: 1702 |
Thanks Geoff |
||||
Bowden_P Senior Member Joined: 20/03/2019 Location: United KingdomPosts: 162 |
Hi lew247, You could try experimenting with "GUI CAPTION" for each string, if the version of MMBASIC you are using has this. Set your chosen colour(s) in the definition for each. To update the strings use the CTRLVAL(ref) for each. Although the command doesn't have a font setting, I believe it uses the currently set one, so change it as required. Just a thought - I haven't tried it to confirm this. With best regards, Paul. Nothing so constant as change. |
||||
Print this page |