Halo I find interesting in this automatic generation of code. (gold v6.07)

Halo

I find after some printing 8888888 some disturbance of picture of New program picture.
The number will be something 23 or higher after 888888

Who can explain and fixed without change picture (New Program)

*** AUTO GENERATED CODE BEGINS HERE ***
! *** SOURCE REF FILE ***EJ20130804
! *** PROGRAM AUTHOR ***
LET author$="Peter Vlasschaert"
! *** PROGRAM NAME ***
LET caption$="New Program"
! *** VERSION HISTORY ***
LET version$=" dated 04 AUG 2013"
option nolet
! *** LIBRARIES ***

!These library modules must be in the TBlibs folder
!otherwise you must specify their full pathnames

LIBRARY "CTX.trc"
LIBRARY "TDX.trc"
LIBRARY "TrueCTRL2.trc"

DECLARE DEF valstr
DIM zero$(1,0:9)
MAT READ zero$
DATA prog,window huis,"","","","","","","",""

DIM menu$(1,0:1)
DIM rmenu$(1,0:1)

! *** ASSIGN VARIABLES ***
LET delim$=chr$(44)
LET eol$=chr$(13) & chr$(10)

! *** INITIALIZATION ***
CALL TC_Init ! Initialize TrueControls
CALL TC_SetUnitsToPixels ! Temporary...
CALL CT_SetUnitsToPixels
CALL TDX_init

CALL splash(caption$,author$,version$,zero$(,),ys) ! Make a splash window using window #0
CALL TC_Show (0) ! So we have something to see

CALL Form_1("New Form",ys)
! *** EVENT LOOP ***
CALL TC_win_switch(0)
let tel=0
DO
WHEN exception in
CALL CT_Event (event$, window, x1, x2, CTid, CTtype)

IF event$="KEYPRESS" and x1 = 27 THEN
EXIT DO ! Exit the event loop when Escape pressed
END IF

IF window=0 then
IF event$="HIDE" then
EXIT DO
ELSEIF event$="MENU" then ! splash menu
SELECT CASE x2 ! selected menu item
CASE 1
CALL TC_show(form1)
CALL TC_win_switch(form1)
tel=tel+1
CASE ELSE ! safety net
END SELECT
END IF
ELSEIF window=form1 then
CALL Form_1_events(ys)
END IF
! *** general purpose error handling routine ***
USE
REM: insert your own message here
CALL TDX_message("PROGRAM ERROR","The program has detected an error.","Continue|Quit",1,result)
LET anytext$=date$ & "/" & time$ & "/" & extext$ & "/" & exline$ & eol$
! CALL append_file("ERRLOG.TXT",anytext$)

IF result>1 then
EXIT DO
END IF
END WHEN

LOOP

CALL TC_Cleanup
CALL TC_Win_Switch(0)

! *** FORM ROUTINES ***

! *** FORM_1 ***

SUB form_1(formname$,ys)
CALL form_1_window
CALL form_1_menu
CALL form_1_objects
CALL form_1_showall
!print "7" !always form print
END SUB
! *** FORM_1 CREATE WINDOW ***
SUB form_1_window

LET option$="TITLE|SIZE|CLOSE|VSCROLL"
CALL TC_win_create(form1,option$,200,300,200,100) !changed
LET wintitle$="huis"
CALL TC_Win_SetTitle(form1,wintitle$)
CALL TC_win_setbrush(form1,7,7,"SOLID")
CALL TC_win_setfont(form1,"SYSTEM",10,"BOLD")
CLEAR
END SUB
! *** FORM_1 CREATE MENU ***

SUB form_1_menu
!print "99"
END SUB

! *** FORM_1 CREATE OBJECTS ***
SUB form_1_objects ! button created

LET option$="test"
CALL CT_PushBtn_create(id1039,option$,3,101,32,7)
CALL CT_setcolor(id1039,-1,12) ! change color button
CALL CT_PushBtn_SetToggle(id1039,1)
CALL CT_setfont(id1039,"SYSTEM",10,"BOLD")
!print "8" !always form
END SUB

! *** FORM_1 SHOW ***
SUB form_1_showall
CALL CT_show(id1039)
! print "5"
END SUB
! *** FORM_1 PROCESSING ***
SUB form_1_events(ys)
IF event$="MENU" then
CALL form_1_menuevent
ELSE
CALL form_1_objectevent(ys)

END IF
END SUB
! *** FORM_1 MENU PROCESSING ***
SUB form_1_menuevent

END SUB
! *** FORM_1 OBJECT PROCESSING ***
SUB form_1_objectevent(ys)
SELECT CASE event$

CASE "RMENU SELECTED"

CASE "SINGLE"
IF CTid=id1039 then ! action button
CALL action_id1039
CALL TC_Show (0)
CALL TC_win_switch(0)
LET pp=24 ! the font size
CALL TC_win_setfont(0,"TIMES",pp,"BOLD")
LET v1=mod(ys,2*pp)
LET v2=int(ys/(pp))
!PRINT v2
SET COLOR 14 ! set color yellow
PRINT "888888888888888888888888888888888 =";tel
END IF

CASE ELSE
END SELECT
END SUB
! *** FORM_1 OBJECT ACTIONS (user code) ***
SUB action_id1039
REM: What do you want to happen when the push button id1039 is clicked?
CALL CT_PushBtn_GetStatus(id1039,status) ! current button status
END SUB

! *** END FORM_1 ***

! *** AUTO GENERATED CODE ENDS HERE ***

! *** USER SUB-ROUTINES ***

END
! *** UTILITIES ***

SUB splash(caption$,author$,version$,zero$(,),ys)
REM: makes a decorative window announcing author and version
REM: allows user to show all windows created by DO_FORM
!***********************************************************
!*determines the size of the users screen *
!*calculates the mid point of the screen *
!*creates a window to fill the screen *
!*adds menu to window *
!*adds color and geometric decoration *
!*adds programe name, author and version number *
!***********************************************************

CALL TC_getscreensize(lscr,rscr,bscr,tscr)
LET midxscr=int((lscr+rscr)/2) ! mid x axis
LET midyscr=int((tscr+bscr)/2) ! mid y axis
CALL TC_setRect(0,lscr+4,rscr-4,bscr-36,tscr+44)
CALL TC_Win_SetTitle (0,caption$)
CALL TC_Menu_Set (0, zero$(,))

REM: set up logical window
ASK PIXELS xpix,ypix
SET WINDOW 0,xpix-1,ypix-1,0

REM: get window internal dimensions
CALL TC_getrect(0,wxl,wxr,wyb,wyt)
LET xs=wxr-wxl
LET x0=round(xs/2)
LET ys=wyb-wyt
LET y0=round(ys/2)
LET yq=round(y0/2)

REM: add geometric decoration
DRAW Decoration(yp,yq,xn,xs,x0,y0,caption$)
CALL TC_win_setfont(0,"SYSTEM",10,"BOLD")
SET COLOR 13
LET half=(STRWIDTH(0,version$))/2
draw vers(version$,x0,y0,half)
CALL TC_win_setfont(0,"HELVETICA",12,"PLAIN")
SET COLOR 13
draw copyright(author$,date$,x0,y0)
END SUB

PICTURE Decoration(yp,yq,xn,xs,x0,y0,caption$)
SET COLOR 9
LET yp=int(yq/15)
LET m=0
FOR n=yp to 1 step-1
LET xn=n*10
LET m=m+1
BOX AREA 1,xs,y0+xn,y0+xn-m
BOX AREA 1,xs,y0-xn,y0-xn+m
NEXT n

REM: Main program title in Blue
CALL TC_win_setfont(0,"TIMES",72,"BOLD")
SET COLOR 12 !title in new program :splash window (red)
LET half=(STRWIDTH(0,caption$))/2
PLOT TEXT, AT x0-half,y0+10: caption$
END PICTURE

picture copyright(author$,date$,x0,y0)
LET copy$="Copyright " & author$ & " " & date$
LET half=(STRWIDTH(0,copy$))/2
PLOT TEXT, AT x0-half,(2*y0)-20: copy$
end picture

picture vers(version$,x0,y0,half)
PLOT TEXT, AT x0-half,(2*y0)-40: version$
end picture
! *** END PROGRAM ***

REM: Untitled1

Comments

re: automated program

I'm not sure exactly what you want to do here, but using multiple PRINT statements will eventually scroll the whole screen as you are seeing. One way around this is to change the lines following the

!print v2

statement as follows. Each time you run test the previous text is cleared and a new line is written at the same location on the screen. IF you want text appearing at the same place all the time, then PLOT TEXT is the a much better choice than PRINT. You can use SET CURSOR to keep printing to the same line on the screen, but again you need to manually clear the old text.

If you want the printing to continue down the screen, then using PLOT TEXT but increasing the y-coordinate with each test would do the trick--at least until you fill up the screen. Then you would need to refresh your title screen and start over.

!PRINT v2
SET COLOR "red" ! yellow doesn't display well
box clear lscr,lscr+1000,tscr+50,tscr+20
plot text, at lscr +10, tscr +50: "888888888888888888888888888888888 = "&str$(tel)

rwt