Latest Uploads
image-15-0 ... -19-40.jpg

Jayenkai

image-15-0 ... -20-07.jpg

Jayenkai

Bumble Bee

dna

Tires

dna

Guess The Remake

rychan

Julia Set Visualer

Andy_A

Forum Home

Txt within a field

UserMessage
Posted : Monday, 17 October 2011, 16:43 | Permalink
dna


Hey.

I'm trying to put text into a field. What the code does is measure the width of the field in pixels, gets the fontwidth() which is in pixels and then returns the maximum number of characters that can be placed into that field.

-->

Using Arial and the default size I get 24 for the fontwidth.

I use NN=Int(WID/FNT_WID)-1 after setting FONT_1=fontwidth() and WID being the width of the field. The number that returns is much smaller than the size of WID. Meaning that I get an amount of characters that is smaller than the space I want to fill.

Do I need to use a monospaced font?


-----
DNA
Posted : Monday, 17 October 2011, 20:14 | Permalink | Mark Here
dna



I tried using a monospaced font and the results were better but the text generated never went all the way across the row of the field.

-----
DNA
Posted : Monday, 17 October 2011, 20:22 | Permalink | Mark Here
dna


Hey all.

I found the solution. Use Stringwidth()


thanks


-----
DNA
Latest Posts
Depressingly Popular...
Jayenkai Wed 12:11
Archos Gamepad Tablet 2
Jayenkai Wed 09:36
What Have You Done - August 2014
Jayenkai Wed 05:19
AGameAWeek Progress Report
Jayenkai Tue 08:46
Ice Bucket Stuffs
steve_ancell Mon 13:40
RIP : Richard Attenborough
steve_ancell Sun 17:45
MS vs Apple
Afr0 Sun 13:16
Actor/Actress Polls 2
dna Sun 13:03
Learning with Monkey : WinMobile Edition
rychan Sun 04:41
Who Hype 2014
Jayenkai Sat 15:48
More

Latest Items
Blog : Health Update : August 2014
Jayenkai Sat 11:31
Showcase : Space Rocket Adventurers
Jayenkai Wed 08:26
Blog : 20 Years Ago....
Jayenkai Sat 09:17
Techy : Back from Game Dev Con!
Jayenkai Sun 16:52
Family : Sunday
Jayenkai Wed 03:31
Family : Good News (for once)
Kuron Tue 15:37
Showcase : Don't Tap The Zombies
therevillsgames Mon 16:26
Showcase : Mutant Monty
steve_ancell Wed 19:26
Blog : Update
Kuron Mon 13:52
Techy : New Laptop!?
Kuron Fri 15:52
Showcase : Ascension 2 Live Wallpaper
CodersRule Fri 13:48
Showcase : Saviors of Gundthor
CodersRule Fri 12:50
Showcase : Lava Monkey
rychan Tue 16:13
Blog : Mac Rant!
rockford Fri 14:48
Dev-Diary : Yup, another song
Kuron Wed 06:39
More

Who's Online
Jayenkai
Wed, at 12:53
HoboBen
Wed, at 12:37
rychan
Wed, at 12:28
rockford
Wed, at 11:59
spinal
Wed, at 11:21
shroom_monk
Wed, at 10:24
steve_ancell
Wed, at 05:30
9572AD
Tue, at 18:37
blanko1324
Tue, at 17:17
brdtt12
Tue, at 16:15
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.