REM gbx% and gby% NEED to be whole numbers and need to be global ( they hold shared text input location )
gbx%=0:gby%=0:split%=0:cursor%=0 :REM GLOBAL VARIABLES
REM split% holds the divide location of the string so edits can be made. ( this is where it gets technical)
tempstr$=""
lx=0:ly=0:lh=0:lv=0
REM define my line position
li=0
MODE 22
COLOUR 1,225,225,225 REM Set background color to windows common color gray (my custom RGB text background color)
GCOL 0 : REM Set graphics foreground to palette color 0 (BLACK)
GCOL 128+1 : REM Set graphics background to palette color 1
VDU 5 : REM Treat text as graphics (transparent background)
OFF:CLG:PROC_color("F",255,255,255)
REM H,V,TEXTLIMIT (getting simpler?)
PROC_input(10,610,50):REM **************************END OF PROGRAM ****************************
PROC_color("f",0,0,0)
PRINT :PRINT "":PRINT:PRINT "Your message is:";MESSAGE$
PRINT "Program done . Waiting for you to close the window. Please do it"
END
REM H,V,TEXTLIMIT (simpler?)
DEF PROC_input(bx,by,textlimit)
LOCAL rback%,gback%,bback%
rback%=255:gback%=255:bback%=255
LOCAL rfore%,gfore%,bfore%,fill
rfore%=0:gfore=0:bfore=0
gbx%=bx:gby%=by:initialx%=0:sl%=0:key$="":MESSAGE$="":MES$=""
initialx%=textlimit*16.2
FOR fill=1 TO 58
PROC_color("f",255,255,255):LINE bx+3,by+20-fill,bx+initialx%,by+20-fill
NEXT fill
PROC_color("f",0,0,0):LINE bx+3,by+20,bx+initialx%,by+20:LINE bx+3,by+20-fill,bx+initialx%,by+20-fill
REPEAT
REPEAT
key$ =INKEY$(1)
PROC_color("F",rfore%,gfore%,bfore%)
MOVE bx,by:PRINT MESSAGE$;"_"
sl%=LEN(MESSAGE$)
remains%=sl%-cursor%
lstring$=LEFT$(MESSAGE$,cursor%):rstring$=RIGHT$(MESSAGE$,remains%)
PROC_moubox
UNTIL key$ <>""
sl%=LEN(MESSAGE$)
IF INKEY(-48) sl%=LEN(MESSAGE$)-1:key$=""
REPEAT UNTIL INKEY(0)=-1
IF MESSAGE$<> MESSAGE$ OR sl%<LEN(MESSAGE$) THEN
PROC_color("F",rback%,gback%,bback%)
MOVE bx,by
PRINT MESSAGE$;"_"
ENDIF
MES$=MID$(MESSAGE$,0,sl%)
MESSAGE$=MES$
PROC_color("F",rback%,gback%,bback%):MOVE bx,by:PRINT MESSAGE$;"_"
IF LEN(key$) = 1 THEN
IF LEN(MESSAGE$)<textlimit THEN PROC_color("F",rback%,gback%,bback%):MOVE bx,by:PRINT MESSAGE$;"_": MESSAGE$=MESSAGE$+key$
REM (jump)
ENDIF
UNTIL INKEY(-74)
ENDPROC
DEF PROC_moubox
REM MOUSE b-- 1-rightbttn 2-mid bttn 4-left bttn
MOUSE x,y,b
LOCAL templen$,tempstr$,strlen%,resposx%,lv%,rr%,gg%,bb%
strlen%=LEN(MESSAGE$)*16
strlen%=strlen%+gbx%
IF y>gby%-35 AND y<gby%+20 THEN
lv%=gbx%
FOR checkx%=lv% TO strlen% STEP 16
IF x>checkx%-13 AND x<checkx%+3 THEN resposx%=checkx%-gbx%
NEXT checkx%
ENDIF
split%=resposx%/16
templen$=STR$(LEN(MESSAGE$))
tempstr$= "X : "+STR$(x)+" Y : "+STR$(y)+" "+"String length : "+templen$+" Text Split%= "+STR$(split%)+" Char: ("+MID$(MESSAGE$,split%,1)+ ") LEFT ("+lstring$+ ")Count:"+STR$(cursor%)+" RIGHT ("+rstring$+") "
cursor%=split%
REPEAT
tempstr$=tempstr$+" "
UNTIL LEN(tempstr$)>60
IF b=4 OR b=1 THEN PROC_pr(30,905,15,15,tempstr$,100,100,200)
IF x<500 AND y<500 THEN
REM PROC_color("F",100,100,100):LINE lx,ly,lh,lv
IF b=4 THEN lx=x:ly=y
IF b=1 THEN lh=x:lv=y
rr%=RND(255)
gg%=RND(255)
bb%=RND(255)
IF x<500 AND y<500 THEN PROC_color("F",rr%,gg%,bb%):LINE lx,ly,lh,lv
ENDIF
ENDPROC
REM ***********************this is my super custom text box tool ***********************
REM X,Y,text color,boarder color,message,r,g,b
REM ************************************************************************
DEF PROC_pr(X,Y,C,CT,msg$,r,g,b)
initialx%=LEN(msg$)
COLOUR 0,r,g,b
GCOL 0
LET tx= X+initialx%+25
LET ty= Y:reduction%=0
reduction%=initialx%/2
reduction%=reduction%*6
IF initialx%<20 THEN reduction%=reduction%/2
initialx%=initialx%*22-reduction%
FOR fill=1 TO 58
LINE X+3,Y+20-fill,X+initialx%,Y+20-fill
NEXT fill
GCOL CT
MOVE tx,ty
PRINT msg$
GCOL C
LINE X,Y+20,X+initialx%,Y+20
LINE X,Y+20,X,Y-40
LINE X,Y-40,X+initialx%,Y-40
LINE X+initialx%,Y-40,X+initialx%,Y+20
LINE X-5,Y+25,X+initialx%+5,Y+25
LINE X-5,Y+25, X-5,Y-45
LINE X+initialx%+5,Y+25,X+initialx%+5,Y-45
LINE X-5,Y-45,X+initialx%+5,Y-45
MOVE 0,0 REM hide that thing
ENDPROC
REM ******************this is a custom Foreground and Background control tool (too much?) *****************
REM color "F"or"B", r,g,b
DEF PROC_color(fb$,r,g,b)
IF fb$="f" OR fb$="F" THEN COLOUR 0,r,g,b : GCOL 0
IF fb$="b" OR fb$="B" THEN COLOUR 1,r,g,b : GCOL 128+1
ENDPROC
REM WORD extractor ****************************************Because I dont want to need any other library?*********************************************************
DEF FNew(txt$,coun)
DIM wl$(255)
LOCAL chk$,ps%,sl%,wc%,getword$
FOR x=0 TO 255
wl$(x)=""
NEXT x
chk$="":wc%=0
sl%=LEN(txt$):ps%=1
REPEAT
chk$=MID$(txt$,ps%,1):ps%=ps%+1
IF chk$=" " THEN chk$="":getword$="yes"
wl$(wc%)=wl$(wc%)+chk$
IF getword$="yes" THEN wc%=wc%+1:getword$="no":chk$=""
UNTIL ps%>sl%
=wl$(coun)