Text Clipping

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
mikroman
User
User
Posts: 11
Joined: Sat Sep 11, 2004 2:04 pm
Location: UK

Text Clipping

Post by mikroman »

Would it be possible to add a feature to the DrawText command so you could restrict your string to a given length in pixels.

For example:

DrawText(Text$,Length)

This way you could restrict your string to say 80 pixels, much more accurate than using the Mid command. :)
plouf
Enthusiast
Enthusiast
Posts: 281
Joined: Fri Apr 25, 2003 6:35 pm
Location: Athens,Greece

Post by plouf »

you can use Length = TextLength(Text$) to get the exact lenght of a string before use it ? or you are asking somethink else ?
Christos
mikroman
User
User
Posts: 11
Joined: Sat Sep 11, 2004 2:04 pm
Location: UK

Post by mikroman »

TextLength only returns the length of the string, it won't help you to restrict how much is printed.

Maybe the answer would be if PB allowed you to set clipping zones on the screen, that way you could restrict text and graphics within that area. Locomotive BASIC on the Amstrac CPC had a similar feature using the Window command. :)
mikroman
User
User
Posts: 11
Joined: Sat Sep 11, 2004 2:04 pm
Location: UK

Problem Solved!

Post by mikroman »

I found a way round my problem by using:

ExtTextOut (Windows Gdi32.lib)

This command lets you output text using a clipping zone, it would be nice if PB could add an easier to use version of this for people who either can't, or don't wand to access the Windows OS. :D
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

I took good note and will probably add a ClipArea() command for clipping all the drawing functions.
mikroman
User
User
Posts: 11
Joined: Sat Sep 11, 2004 2:04 pm
Location: UK

Post by mikroman »

That's great news Fred :D

PB keeps getting better with each release, keep up the good work.
Blade
Enthusiast
Enthusiast
Posts: 362
Joined: Wed Aug 06, 2003 2:49 pm
Location: Venice - Italy, Japan when possible.
Contact:

Post by Blade »

Go for it! :D
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> I took good note and will probably add a ClipArea() command

This is why I love PureBasic. :) I came from Visual Basic and whenever I sent
an e-mail to mswish@microsoft.com I would NEVER get an answer like that. :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Post Reply