Page 1 of 1
Text Clipping
Posted: Sun Feb 13, 2005 12:12 am
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.

Posted: Sun Feb 13, 2005 9:20 pm
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 ?
Posted: Sun Feb 13, 2005 10:32 pm
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.

Problem Solved!
Posted: Fri Feb 18, 2005 4:53 pm
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.

Posted: Fri Feb 18, 2005 5:13 pm
by Fred
I took good note and will probably add a ClipArea() command for clipping all the drawing functions.
Posted: Fri Feb 18, 2005 6:02 pm
by mikroman
That's great news Fred
PB keeps getting better with each release, keep up the good work.
Posted: Fri Feb 18, 2005 6:58 pm
by Blade
Go for it!

Posted: Fri Feb 18, 2005 8:24 pm
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.
