[Gambas-user] Gambas Printing

Benoit Minisini gambas at ...1...
Tue Jul 27 10:36:58 CEST 2004


On Tuesday 27 July 2004 09:51, Budi Arief Gusandi wrote:
> Dear Benoit,
>
> 1. Why the variabel with byte data type still can be assigned with value
> less dan 0 or more than 255 ? the value return is also strange. I can even
> assign with boolean value.
>
> Dim i as byte
> i = 10
> message.info (i) 'return 10. Correct !
> i = True
> message.info (i) 'return 255 ???
> i = -10
> message.info (i) 'return 246 ???

Because gambas does not check integer overflow when converting from one type 
to the other. So, when you convert any integer value to a byte, only the 
lowest byte is kept. And when you convert TRUE, you get 255 because TRUE is 
stored as -1 in memory.

I don't know how to check overflow after a conversion in C, without doing slow 
supplementary tests.

>
> 2. How to print text to next line without resupplying X and Y position ?
> just like in VB : printer.print "Hello", when i try to do the same
> command, it will print to the next line with the same x pos. How can i do
> that with draw ?
>
> draw.text("test1",100,100) <-- works
> draw.text("test2") ???
>

Does 'Draw.Text("test1\ntest2", 100, 100)' work ?

>
> Regards,
>
> Budi
>

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list