|
MX-TextField
6
24
727 bytes
1316 bytes
2003-12-11 00:00:00
2005-10-08 12:13:44
Oldes (oliva.david@seznam.cz)

To make textfield with scroller
|
|
background 153.165.139
include %includes/txt_info.rswf
importAssets [spr_scroller "scroller"] %examples/compiled/swf5-scroller.swf
fnt_ArialN: font [name "_sans"]
txt_testField: EditText test 286x149 [
Font [fnt_ArialN 11] border
color #000000
wordwrap multiline
]
tf: place txt_testField at 0x20
sc: place spr_scroller at 286x20
doAction [
sc.onChange: func[][
tf: _parent.tf
tf.scroll: 1 + ((tf.maxscroll - 1) * data)
;_parent.info: rejoin ["sc.data:" data " m:" tf.maxscroll " h:" h]
]
sc.resize(150)
tf.onScroller: func[][
if not sc.draging [
if tf.lastMaxscroll <> tf.maxscroll [
tf.lastMaxscroll: tf.maxscroll
d: tf.maxscroll - 1
either tf.maxscroll > 1 [
r: 1 - (d * 0.01)
sc.setRatio(r)
sc.setStep((1 / d ))
;sc.redrag(((tf.scroll - 1) * sc.step))
][
sc.setRatio(1)
]
]
sc.redrag(((tf.scroll - 1) * sc.step) false)
info: rejoin ["oS! step:" sc.step " r:" r " a:" sc.draging]
]
]
info: "Write some text into the large field"
test: "1^/2^/3^/4^/5^/6^/7^/8^/9^/10"
;tf.onChanged()
]
show frame
end
|