DECLARE SUB QspintextOnChange (vl AS LONG)
TYPE Qspintext EXTENDS QPANEL
OnChange AS EVENT (QspintextOnChange)
public:
max AS LONG
min AS LONG
value AS LONG
bgcolor AS LONG
fontcolor AS LONG
ed AS QEDIT
sb AS QSCROLLBAR
SUB initial
WITH Qspintext
.sb.max=.min * -1
.sb.min=.max * -1
.ed.text=STR$(.value)
.ed.PARENT=Qspintext
.sb.PARENT=Qspintext
.sb.kind=1
.sb.width=18
.sb.top=2 :
.sb.height=18
.ed.top=3
.ed.left=2
.ed.height=16 :
.ed.borderstyle=0
.ed.width=Qspintext.width - 22
.sb.left= .ed.width+.ed.left+2
.ed.COLOR=.bgcolor
.ed.font.COLOR=.fontcolor
END WITH
END SUB
EVENT sb.onchange
DIM p AS LONG
WITH Qspintext
p=.sb.position * -1
.ed.text=STR$(p)
.value=p
vl=p
Qspintext.ed.COLOR=Qspintext.bgcolor
CALLFUNC(.OnChange,vl)
END WITH
END EVENT
EVENT ed.onchange
END EVENT
EVENT ed.onkeydown (key AS WORD, shift AS INTEGER)
DIM p AS LONG
p=Qspintext.sb.position
IF key=38 THEN
DEC p :
Qspintext.sb.position = p
Qspintext.ed.COLOR=Qspintext.bgcolor
ELSEIF key=40 THEN
INC p :
Qspintext.sb.position = p
vl=Qspintext.sb.position
Qspintext.ed.COLOR=Qspintext.bgcolor
ELSEIF key=13 THEN
Qspintext.sb.position=VAL(Qspintext.ed.text) * -1
Qspintext.ed.COLOR=Qspintext.bgcolor
CALLFUNC(Qspintext.OnChange,vl)
ELSE
Qspintext.ed.COLOR=&H0000FF
END IF
END EVENT
CONSTRUCTOR
width=50 : height=22
sb.kind=1
sb.width=18
sb.top=2 :
sb.height=18
ed.top=3
ed.left=2
ed.height=16 :
ed.borderstyle=0
ed.width=Qspintext.width - 22
sb.left= Qspintext.ed.width+Qspintext.ed.left+2
ed.COLOR=-2147483648
bgcolor=-2147483643
fontcolor=0
bevelouter=1
END CONSTRUCTOR
END TYPE
|