G4C

; An example for using the xPIPE event
; ---------------------------------------------------------------


WINBIG 146 40 412 134 pipe.gc
WinType 11110001
varpath ''

CTEXT 22 3 "xPIPE Event" topaz.font 9 2 0 0001

xOnLoad
	GuiOpen pipe.gc

xOnClose
	GuiQuit pipe.gc


; ---------------------------------------------------------------
;	The listview
; ---------------------------------------------------------------

; a listview to show the results

XLISTVIEW 2 17 407 116 "" var "" 10 MULTI
	gadfont #mono 8 000        ; looks nicer lined up..
	gadid 1


; ---------------------------------------------------------------
;	Buttons for Avail and Flush
; ---------------------------------------------------------------

; the buttons which run "avail" and "avail flush" 

; Note : we don't have to issue the lvuse and lvadd
; commands - they are only there to make it look nicer..
; The "›32m" characters turn on/off the text highlighting.


XBUTTON 171 0 96 16  "Avail"
	lvuse pipe.gc 1                 ; use the above listview
	lvadd "›32m----> Avail :›31m"   ; add a fancy banner (looks nicer)
	run 'c:avail >pipe:MyPipe'      ; run avail > our pipe


XBUTTON 269 0 139 16   "Avail Flush"
	lvuse pipe.gc 1
	lvadd "›32m----> Avail Flush :›31m"
	run 'c:avail >pipe:MyPipe flush'


; ---------------------------------------------------------------
;	The PIPE event
; ---------------------------------------------------------------

; This is the xPIPE event that will happen when the above
; avail commands send stuff to our pipe. We'll start it off
; as ON and keep it like that. It will quit when the gui quits.


xPIPE pipe:MyPipe ON
	; now here, the internal var $$PIPE.TXT has a line of text 
	; ready for us. We use our above listview to show it..
	lvuse pipe.gc 1
	lvadd $$PIPE.TXT


	; This event will be called again and again for every line
	; that the c:avail command outputs.





