- OpenLaszlo紹介
- プログラム構造関連
- スクリプト
- Javascript基礎
- 基礎知識
- ビュー<view>
- レイアウト
- 動かす
- 入力デバイス
- 文字
- 数値
- 日付
- オブジェクト指向
- 標準コンポーネント
- データの扱い
- データ操作(基礎)
- 応用編
–
<edittext>内の入力行数が表示可能行数を超えると、<scrollbar>が自動で表示されます。下のサンプルで4行以上入力してみてください。
本家フォーラムからの拾い物。
参考:http://forum.openlaszlo.org/showthread.php?t=12723
【注意】 OpenLaszlo4.2.0.1で、swf8とswf9で動作確認しました。
<?xml version="1.0" encoding="UTF-8"?> <canvas proxied="false" bgcolor="0xeeeeee"> <class name="edittext_scrollbar" width="200" height="50"> <edittext name="ed" multiline="true" width="${parent.width}" height="${parent.height}"> <handler name="oninit"> this.field['fakeScroll'] = this.field['scroll']; var del = new LzDelegate(this, "doScroll"); del.register(this.field, "onfakeScroll"); </handler> <handler name="onscroll" reference="this.field"> if(this.field.scroll != this.field.fakeScroll){ this.field.setAttribute('fakeScroll', (this.field.scroll-1)*-1); } </handler> <method name="doScroll" args="arg"> this.field.setScroll((-1*this.field.fakeScroll)+1); </method> </edittext> <scrollbar x="${parent.ed.x+parent.ed.width}" height="${parent.ed.height}" visible="${this.scrollable}" scrolltarget="parent.ed.field" scrollattr="fakeScroll" scrollmax="${parent.ed.field.maxscroll+parent.ed.height-1}" stepsize="1" /> </class> <edittext_scrollbar/> </canvas>