Help with Text

BlitzPlus Forums/BlitzPlus Programming/Help with Text

kfprimm(Posted 2005) [#1]
Im writing a software program and im trying to write words to the screen without using print, but the program wont seem to write the text to the screen. How can i fix this? By the way im using gui instead of setting up a graphics mode.


rdodson41(Posted 2005) [#2]
If there is an error message, please post the message. If not, make sure you have a SetBuffer CanvasBuffer(mycanvas) after your canvas is created, and also make sure you have FlipCanvas(mycanvas) in there after all the text is drawn.


CS_TBL(Posted 2005) [#3]
Using 'print'? doesn't that only print to that console thingy?


Mr Brine(Posted 2005) [#4]
Yeah, it does. If I were Khomy Prime Id use labels or go with rich05s way


kfprimm(Posted 2005) [#5]
Well i have done exactly as rich05 has said but it still does not work


rdodson41(Posted 2005) [#6]
Try something like this:
;Create GUI
window=CreateWindow("Test Window",0,0,500,300)
canvas=CreateCanvas(0,0,500,300,window)

;Make sure you have this
SetBuffer CanvasBuffer(canvas)

;Main loop
While Not Keyhit(1)
   ;Clearscreen
   Cls

   ;Have your text drawn here
   Text 50,50,"Text"

   ;Make sure you have this, or else you wont see the text
   FlipCanvas(canvas)
Wend
End

If you get an 'invalid buffer' error, its probably you dont have the SetBuffer CanvasBuffer(canvas). If the text doesn't appear on the screen, then either you forgot FlipCanvas(canvas) or you drew your text offscreen.

It also might help if you post some code.


kfprimm(Posted 2005) [#7]
yeah i made my software use desktop() along with
gadgetx() and gadgety()to determined the width and height of the window and thatcaused the program 2 mess up. Thanks Rich05