WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Dialog Boxes

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Status Box UDF

Keywords: 	 Status Box UDF

; StatusBox - functions by Mic Terpstra - Created Dec 5, 2001
;Minor rev MW Feb 14, 2002

; Functions in this file:
; Handle = StatusboxInit(Title,NumberOfLines)     	    Creates the statusbox - Parameter 2  is lines remembered inside the buffer
; StatusboxUpd(Handle,newline)						 inserts new text and makes it scroll upward
; StatusboxHide(Handle) 								 makes the statusbox minimize
; StatusboxShow(Handle)									 restores the box and it's contents
; StatusboxClose(Handle)								 closes the box, releases the binary handle


#DefineFunction StatusBoxInit(Title,lines)
statusboxhandle = binaryalloc(lines*100+150)
binarypoke(statusboxhandle,0,lines)
boxopen(Title,"")
return statusboxhandle
#EndFunction

#DefineFunction StatusBoxUpd(Statusboxhandle,statusboxnewline)
displacement = 5
lines=binarypeek(statusboxhandle,0)
for x = 0 to lines-2
	binarycopy(statusboxhandle,(x*100)+displacement,statusboxhandle,((x*100)+100)+displacement,100)
next
binarypokestr(statusboxhandle,((lines-1)*100)+displacement,strfix(statusboxnewline," ",100))
StatusBoxText = Strcat(binarypeekstr(statusboxhandle,(0)+displacement,100),@CR)
for x = 1 to lines-1
	StatusBoxText = Strcat(Statusboxtext,binarypeekstr(statusboxhandle,(x*100)+displacement,100),@CR)
next
boxtext(Statusboxtext)
#EndFunction

#DefineFunction StatusBoxHide(Statusboxhandle)
boxshut()
#EndFunction

#DefineFunction StatusBoxShow(Statusboxhandle)
displacement = 5
lines=binarypeek(statusboxhandle,0)
StatusBoxText = Strcat(binarypeekstr(statusboxhandle,(0)+displacement,100),@CR)
for x = 1 to lines-1
	StatusBoxText = Strcat(Statusboxtext,binarypeekstr(statusboxhandle,(x*100)+displacement,100),@CR)
next
boxopen("",Statusboxtext)
#EndFunction
 
#DefineFunction StatusBoxClear(Statusboxhandle)
displacement = 5
lines=binarypeek(statusboxhandle,0)
for x = 0 to lines-1
	binarypokestr(statusboxhandle,(x*100)+displacement,strfill(" ",100))
next
StatusBoxText = Strcat(binarypeekstr(statusboxhandle,(0)+displacement,100),@CR)
for x = 1 to lines-1
	StatusBoxText = Strcat(Statusboxtext,binarypeekstr(statusboxhandle,(x*100)+displacement,100),@CR)
next
boxtext(Statusboxtext)
#EndFunction

#DefineFunction StatusboxClose(Statusboxhandle)
boxshut()
binaryfree(statusboxhandle)
#Endfunction




;Example
sb = StatusboxInit("Desired Title",5)
For xx=1 to 50
   StatusboxUpd(sb,strcat("This is line ",xx))
   TimeDelay(0.1)
Next
StatusboxClose(sb)


Article ID:   W15739
File Created: 2003:05:13:11:29:54
Last Updated: 2003:05:13:11:29:54