[futurebasic] Re: [FB] print record definition?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2001 : Group Archive : Group : All Groups

From: Alain Pastor <apastor@...>
Date: Sat, 08 Sep 2001 20:34:28 +0200
jonathan wrote:
> 
> wierd bugs in the goldmine baby...
> 
> i am having severe problems with DRAWTEXT [for those of you who have never
> rubbed up against this one, it prints a line of text... up to 32K long!].
> from thinkref the syntax is:
> 
> DrawText(textBuf, byteOff, byteCnt);
> 
> however there is a warning:
> <quote>
> This function temporarily stores byteCnt characters on the stack, even if
> the resulting output will be clipped. Use TEXTWIDTH to learn how much of the
> string will fit on the screen.
> </quote>
> 
> apparently this call works perfectly the first time i call it... but prints
> trash subsequent times when called from the same handle... i thought that i
> wasn't nailing down the handle and so on, but no, it seems it's not that.
> 
> so now i'm wondering the sense of the warning in thinkref, and wondering if
> behind the scenes things are becoming desynchronised.
> 
Well, I've just tried that and it seems to work here, even without
locking the handle (note that the example in Think Ref does lock the handle):

DIM AS HANDLE        theH
DIM AS UNSIGNED LONG hSize,offset,txtLen
WINDOW 1
theH = FN GetIndResource(_"TEXT",1)
LONG IF theH
  hSize  = FN GetHandleSize(theH)
  offset = 0
  WHILE offset < hSize
    LONG IF hSize - offset >= 25
      txtLen = 25
    XELSE
      txtLen = hSize - offset
    END IF
    DrawText([theH],offset,txtLen)
    offset += txtLen
    PRINT
  WEND
XELSE
  PRINT "Go buy another computer, this one doesn't work.";
END IF
DO
  HANDLEEVENTS
UNTIL FN Button

-- 

Cheers

Alain

-----------------------------------------------------
FB^3 in Europe:  http://euro.futurebasic.com/
FB II Pouch:     http://www.pixmix.com/FB/outils.html
-----------------------------------------------------