1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 from __pyjamas__ import JS
16 from pyjamas import Factory
17 from pyjamas import DOM
18
19 from pyjamas.ui.TextBoxBase import TextBoxBase
20
21 -class TextArea(TextBoxBase):
22 """
23 HTML textarea widget, allowing multi-line text entry.
24 Use setText/getText to
25 get and access the current text.
26 """
27
28 _props = [("rows", "Rows", "VisibleLines", None),
29 ("cols", "Columns", "CharacterWidth", None),
30 ]
31
32 - def __init__(self, **ka):
33 ka['StyleName'] = ka.get('StyleName', "gwt-TextArea")
34 element = ka.pop('Element', None) or DOM.createTextArea()
35 TextBoxBase.__init__(self, element, **ka)
36
37 @classmethod
38 - def _getProps(self):
40
42 return DOM.getIntAttribute(self.getElement(), "cols")
43
44 - def getCursorPos(self):
46
48 return DOM.getIntAttribute(self.getElement(), "rows")
49
50 - def setCharacterWidth(self, width):
51 DOM.setIntAttribute(self.getElement(), "cols", width)
52
53 - def setVisibleLines(self, lines):
54 DOM.setIntAttribute(self.getElement(), "rows", lines)
55
56 Factory.registerClass('pyjamas.ui.TextArea', 'TextArea', TextArea)
57