NEW
  AUTO 3,1
				.LIST OFF
*--------------------------------------
* LBOX.New hParent,X1,Y1,W,H,F,pList,pVar	10
*--------------------------------------
LBOX.New		lda #S.OBJ.T.LBOX
				jsr OBJ.Create
				bcs .9

				ldy #S.OBJ.pVar
				jsr OBJ.PullWordY

				ldy #S.OBJ.pBuf
				jsr OBJ.PullWordY

				>PULLA
				ldy #S.OBJ.F
				sta (ZPObjPtr),y

				jsr OBJ.PullHW

				jsr OBJ.PullY1X1hParent

				jsr CONT.Insert
				bcs .99
				
				lda hObj
*				clc
				rts				

.9				>POP 10

.99				rts
*--------------------------------------
LBOX.Run		ldy #S.OBJ.S
				lda (ZPObjPtr),y
				bpl .9
				
				lda (pStack)			Event
				cmp #C.LF
				bne .2

				ldy #S.LBOX.Idx
				lda (ZPObjPtr),y
				inc
				tax
				
				ldy #S.OBJ.pBuf
				jsr OBJ.GetLineXAtY
				bcs .8

				ldy #S.LBOX.Idx
				lda (ZPObjPtr),y
				inc
				sta (ZPObjPtr),y

				clc
				ldy #S.LBOX.VScroll
				adc (ZPObjPtr),y
			
				ldy #S.OBJ.InnerH
				cmp (ZPObjPtr),y
				bcc .7
				
				ldy #S.LBOX.VScroll
				lda (ZPObjPtr),y
				inc
				sta (ZPObjPtr),y
				bra .7
				
.2				cmp #C.VT
				bne .9

				ldy #S.LBOX.Idx
				lda (ZPObjPtr),y
				beq .8

				dec
				sta (ZPObjPtr),y
				
				ldy #S.LBOX.VScroll
				cmp (ZPObjPtr),y
				bcs .7
				
				ldy #S.LBOX.VScroll
				lda (ZPObjPtr),y
				dec
				sta (ZPObjPtr),y
				
.7				ldy #1					hObj
				lda (pStack),y
				>PUSHA

				jsr OBJ.Draw.Body

				inc pStack
				rts

.8				clc
				rts

.9				lda #0
				sec
				rts
*--------------------------------------
LBOX.Draw		ldy #S.LBOX.VScroll
				lda (ZPObjPtr),y
				clc
				adc (pStack)			Relative Y
				tax

				ldy #S.OBJ.pBuf
				jsr OBJ.GetLineXAtY
				bcs .5
				
				txa
				ldy #S.LBOX.Idx
				cmp (ZPObjPtr),y
				bne .1
	
				ldy #S.OBJ.S
				lda (ZPObjPtr),y		S.OBJ.S.bActive
				bpl .1

				ldx #SEQ.INVERSE-SEQS
				jsr LB.SeqOut
	
.1				ldy #S.OBJ.InnerW
				lda (ZPObjPtr),y
				tax

				jsr LB.Ptr1OutEscMaxX
				txa
				beq .8
				bne .6
				
.5				ldy #S.OBJ.InnerW
				lda (ZPObjPtr),y
				tax
				
.6				lda #C.SPACE

.7				jsr LB.COut
				dex
				bne .7
				
.8				clc
				rts
*--------------------------------------
LBOX.Activate
LBOX.Deactivate
				jmp OBJ.Draw.Body
*--------------------------------------
MAN
SAVE usr/src/lib/libtui.s.lbox
LOAD usr/src/lib/libtui.s
ASM
