'******************************************************* '* Qscrn created by Sven.TG for use in Plains of Sedia * '* Current Version: 2.12e Updated: April 1st 2006 * '******************************************************* '* New Methods: * '* .clear (merely revised) * '* .hilight (hilight) * '* .show "",... (addstrings then hilight) * '* .showmodule (Run @ initialize only, makes EDITbox * '* .hilight (Run after show "",...) * '* .makeQSCRNEDIT(PRIVATE MODULE, DON'T USE) * '******************************************************* '* Sub Modules * '* QSCRNEDIT AS QEDIT * '* color=&H111111 * '* BUILT @ BOTTOM OF QSCRN * '******************************************************* ' DECLARE FUNCTION SetFocus LIB "User32" ALIAS "SetFocus" (hwnd AS LONG) AS LONG TYPE Qscrn EXTENDS QRichEdit SCRNEDITFONT AS QFONT 'SCRNEDITFONT SCRNFont AS QFont 'SCRNFont used throughout the construct showlines(100) AS STRING 'extend () as needed text2 as string 'text2 is .text with the switches lastcolor as integer 'shows color untill next switch / SCRNTempVar1 as string 'need to declare @ toplevel or form will show variables @ different Richedit's SCRNTempVar2 as string 'need to declare @ toplevel or form will show variables @ different Richedit's QSCRNEDIT as qedit 'SCRNEDIT MODULE QSCRNEDITHANDLE as integer 'SCRNEDIT HANDLE, created on QSCRN.QSCRNEDIT.SHOWMODULE SUB HiLight dim a$ as string, b$ as string, c$ as string dim a# as integer, b# as integer, c# as integer dim totalswitches# as integer WITH Qscrn totalswitches#=0:a#=0:b#=0:c#=0:a$="":b$="":c$="" .hideselection=1 a$=mid$(.text2,1,1):if a$ <>"/" then:.text2="/z"+.text2:end if 'makes sure there is color in the beginning a$=.text2 .text=.text2-"/@"-"/x"-"/X"-"/b"-"/B"-"/g"-"/G"-"/m"-"/M"-"/y"-"/Y"-"/c"-"/C"-"/z"-"/Z"-"/r"-"/R"-"/+"-"/!"-"/i"-"/_"-"/-" a#=len(a$) for b#=1 to a# step 1 b$=mid$(a$,b#,1) if b$="/" then:b$=mid$(a$,b#,2) if b$="/x" then:.lastcolor=0 totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/b" then:.lastcolor=&H800000 totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/g" then:.lastcolor=&H8000 totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/c" then:.lastcolor=&H808000 totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/r" then:.lastcolor=&H80 totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/m" then:.lastcolor=&H800080 totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/y" then:.lastcolor=&H8080 totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/X" then:.lastcolor=&HFFFFFF totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/z" then:.lastcolor=&H606060 totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/Z" then:.lastcolor=&HC0C0C0 totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/B" then:.lastcolor=&HFF0000 totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/G" then:.lastcolor=&HFF00 totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/C" then:.lastcolor=&HFFFF00 totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/R" then:.lastcolor=&HFF totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/M" then:.lastcolor=&HFF00FF totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/Y" then:.lastcolor=&HFFFF totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/+" then totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .SCRNFont.addstyles=0 .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/i" then totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .SCRNFont.addstyles=1 .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/_" then totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .SCRNFont.addstyles=2 .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/-" then totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .SCRNFont.addstyles=3 .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next elseif b$="/!" then totalswitches#=totalswitches#+1 for c#=b#+1 to a# step 1:c$=mid$(a$,c#,1) if c$="/" then .SCRNFont.delstyles=0 .SCRNFont.delstyles=1 .SCRNFont.delstyles=2 .SCRNFont.delstyles=3 .selstart=(b#+1)-(totalswitches#*2) .sellength=c#-(totalswitches#*2) .SCRNFont.color=.lastcolor .selattributes=.SCRNFont c$=mid$(a$,c#,2) if c$="/@" then b#=a# end if exit for end if next end if end if next a#=len(.text2):b$=mid$(.text2,a#-2,2):if b$="/@" then:.text2=mid$(.text2,1,a#-2):a#=len(.text2):end if c#=len(.text):.hideselection=0:.selstart=c#-1:.sellength=0 END WITH END SUB SUBI show(...) DIM a# AS INTEGER,b# AS INTEGER DIM sublen as integer,totallen as integer WITH Qscrn FOR b# = 1 TO ParamStrCount .SCRNTempVar2=.SCRNTempVar2+ParamStr$(b#)+chr$(10) NEXT .text2=.SCRNTempVar2+"/@" .SCRNTempVar1=.text2-"/@"-"/x"-"/X"-"/b"-"/B"-"/g"-"/G"-"/m"-"/M"-"/y"-"/Y"-"/c"-"/C"-"/z"-"/Z"-"/r"-"/R"-"/+"-"/!"-"/i"-"/_"-"/-" totallen=len(.SCRNTempVar1):sublen=2000-totallen if sublen <0 then for a#=abs(sublen)+100 to 1 step -1 .SCRNTempVar1=mid$(.text2,a#,1) if .SCRNTempVar1=chr$(10) then .text2=delete$(.text2,1,a#) totallen=len(.SCRNTempVar2):sublen=3000-totallen if sublen<0 then for a#=abs(sublen)+100 to 1 step -1 .SCRNTempVar1=mid$(.SCRNTempVar2,a#,1) if .SCRNTempVar1=chr$(10) then .SCRNTempVar2=delete$(.SCRNTempVar2,1,a#) exit for end if next end if exit for end if next end if END WITH END SUBI SUB CLEAR QSCRN.text="":QSCRN.text2="":QSCRN.SCRNTempVar1="":QSCRN.SCRNTempVar2="" END SUB sub constructQSCRNEDIT QSCRN.height=QSCRN.height-25 QSCRN.QSCRNEDIT.parent=QFORM QSCRN.QSCRNEDIT.width=QSCRN.width QSCRN.QSCRNEDIT.left=QSCRN.left QSCRN.QSCRNEDIT.top=QSCRN.height+QSCRN.top end sub sub showmodule QSCRN.hilight QSCRN.constructQSCRNEDIT QSCRN.color=0 QSCRN.QSCRNEDIT.color=&H222222 QSCRN.SCRNEDITFONT.color=&h808080 QSCRN.SCRNEDITFONT.name="Courier" QSCRN.SCRNEDITFONT.size=10 QSCRN.QSCRNEDITHANDLE=QSCRN.QSCRNEDIT.handle QSCRN.QSCRNEDIT.font=QSCRN.SCRNEDITFONT end sub CONSTRUCTOR PlainText = True SCRNFont.Name = "Courier" SCRNFont.pitch=0 SCRNFont.size=10 SCRNFont.color=0 Font = Qscrn.SCRNFont END CONSTRUCTOR END TYPE Declare sub Keydown(Key AS BYTE, Shift AS BYTE) create MAIN as qform width=500 height=500 borderstyle=4 caption="Type anything and hit ENTER]::.. ." center create SCRN as QSCRN left=0 top=0 width=500 height=482 readonly=1 hidescrollbars=0 taborder=1 show("/Y[/yTEXT COLOR AND STYLE/Y]","/yTo use color in the form input, simply use switches:","/y(make sure to change the forward slash to a backward slash.)"," /x\x /X\X /z\z /Z\Z /g\g /G\G /m\m /M\M /b\b /B\B "," /r\r /R\R /c\c /C\C /y\y /Y\Y","","/yText style switches: ","/y \_ = /_TEXT/!","/y \+ = /+TEXT/!","/y \- = /-TEXT/!","/y \i = /iTEXT/!","/y \! removes all the text style switches, only way to turn them off") QSCRNEDIT.onkeydown=Keydown QSCRNEDIT.taborder=0 SHOWMODULE color=0 end create end create setfocus(SCRN.QSCRNEDITHANDLE) MAIN.showmodal sub Keydown(Key AS BYTE, Shift AS BYTE) if key=13 then a$=SCRN.QSCRNEDIT.text:SCRN.QSCRNEDIT.text=0:a$=ltrim$(rtrim$(a$)) SCRN.show("/z"+a$+"/!") SCRN.hilight elseif key=27 then MAIN.close end if end sub