Latest Uploads
Invasion V ... tup screen

rychan

image-07-1 ... -20-59.jpg

Jayenkai

PixeLink - ... oween 2014

rockford

PixeLink P ... zle Editor

rockford

PixeLink

rockford

image-21-0 ... -21-29.jpg

Jayenkai

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
Making An Advent Calendar Collection
Jayenkai Mon 10:12
Ffffffffreeeeezinnggg ffffffeck!
steve_ancell Mon 07:06
What Have You Done - Oct 2014
Afr0 Mon 01:26
Mass emailing
Kuron Sun 15:02
Happy Birthday Mog
Kuron Sun 09:48
Happy Birthday : Rockford's Mum
rockford Sun 09:04
Dinner or Breakfast?
steve_ancell Sun 05:24
New Oliver Twins Project
steve_ancell Sun 04:27
Strangers on the Street
steve_ancell Sat 16:35
Number Racer - Back on to it!
rockford Sat 12:18
More

Latest Items
Life : Health Update
rockford Thu 12:41
Dev-Diary : Scaling Back
rychan Thu 03:55
Blog : Powerball Hack
steve_ancell Tue 18:47
Showcase : GPS Fun Runner 3D
zzoom Tue 06:03
Hols : Advent Calendars
rychan Wed 04:56
Life : MIA until better
Jayenkai Mon 07:03
News : Newsletter #241
steve_ancell Thu 20:46
Snippet : Monkey Framework - HTML Layout
steve_ancell Thu 08:35
Woot : Update on hand issues
rychan Fri 10:00
News : Newsletter #240
steve_ancell Fri 05:29
Techy : My Newest Toys
Jayenkai Sun 04:16
News : Newsletter #239
Jayenkai Sat 05:34
Showcase : Preppie!
Jayenkai Fri 13:00
Rant : : I Stubbed My Toe...
steve_ancell Tue 09:47
:
Wed 17:00
More

Who's Online
blanko1324
Mon, at 18:00
Jayenkai
Mon, at 17:29
rychan
Mon, at 17:20
steve_ancell
Mon, at 17:04
Mog
Mon, at 16:59
HoboBen
Mon, at 16:34
Dabz
Mon, at 15:36
rockford
Mon, at 15:14
spinal
Mon, at 14:22
Afr0
Mon, at 14:18
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.