Latest Uploads
Kuron Cap Get!

rychan

Merry Christmas

Jayenkai

Invasion V ... tup screen

rychan

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

Jayenkai

PixeLink - ... oween 2014

rockford

PixeLink P ... zle Editor

rockford

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
Mums and Tech
Jayenkai Fri 18:20
Jay is Resting
Jayenkai Fri 18:12
Welcome, Steve Elliott
Dabz Fri 08:03
Cardboard VR
spinal Fri 04:52
Daily Doodles
Jayenkai Fri 04:35
Purchase Me Do
rychan Fri 04:12
Saving Youtube Videos
Jayenkai Fri 04:01
Great Big Youtube thread
rockford Fri 02:33
Penguin Party
rychan Thu 15:48
AGameAWeek : Year 7 : Part One
Jayenkai Thu 06:21
More

Latest Items
Showcase : Futrino
Jayenkai Thu 06:16
Showcase : Millenipede
Steve Elliott Mon 17:44
Showcase : Flappy New Year
rychan Wed 02:49
Snippet : Simple stack-based interpreter
tbohon Wed 12:08
Link : Protolol
Afr0 Tue 10:53
Showcase : Santa's Workout 2
jayparker Tue 00:43
Dev-Diary : Stripping it All Away
Jayenkai Mon 01:57
News : Newsletter #245
rychan Fri 06:36
Showcase : GPS Fun Runner 3D
zzoom Wed 15:35
Showcase : The Biggest Snowman
rychan Mon 01:06
News : Newsletter #243
Dabz Thu 03:29
Dev-Diary : Scaling Back
rychan Wed 14:33
Showcase : Alpha Collexion
rychan Wed 06:23
Life : Health Update
rockford Thu 12:41
Blog : Powerball Hack
steve_ancell Tue 18:47
More

Who's Online
blanko1324
Fri, at 22:12
rockford
Fri, at 21:49
steve_ancell
Fri, at 20:15
Kuron
Fri, at 20:04
Jayenkai
Fri, at 19:05
Steve Elliott
Fri, at 14:17
rychan
Fri, at 13:45
spinal
Fri, at 13:30
Dabz
Fri, at 10:40
shroom_monk
Fri, at 09:11
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.