tuikit/textedit.py
changeset 34 e3beacd5e536
parent 18 e6c3a5ee91aa
child 40 5faa38c10b67
equal deleted inserted replaced
33:45f1b6d590bd 34:e3beacd5e536
    22         self.vscroll.y = 1
    22         self.vscroll.y = 1
    23         self.vscroll.connect('change', self.on_vscroll_change)
    23         self.vscroll.connect('change', self.on_vscroll_change)
    24 
    24 
    25         self.on_editbox_areasize()
    25         self.on_editbox_areasize()
    26 
    26 
    27         self.connect('draw', self.on_draw)
       
    28 
       
    29 
       
    30     def settext(self, text):
    27     def settext(self, text):
    31         self.editbox.set_text(text)
    28         self.editbox.set_text(text)
    32 
    29 
    33 
    30 
    34     def scrolltoend(self):
    31     def scrolltoend(self):
    35         self.editbox.move_pagelast()
    32         self.editbox.move_pagelast()
    36 
    33 
    37 
    34 
    38     def on_draw(self, screen, x, y):
    35     def on_draw(self, screen, x, y):
       
    36         super().on_draw(screen, x, y)
    39         screen.frame(x, y, self.width, self.height)
    37         screen.frame(x, y, self.width, self.height)
    40 
    38 
    41 
    39 
    42     def on_editbox_scroll(self):
    40     def on_editbox_scroll(self):
    43         self.vscroll.setpos(self.editbox.yofs)
    41         self.vscroll.setpos(self.editbox.yofs)
    49             smax = 0
    47             smax = 0
    50         self.vscroll.max = smax
    48         self.vscroll.max = smax
    51 
    49 
    52 
    50 
    53     def on_vscroll_change(self):
    51     def on_vscroll_change(self):
    54         self.editbox.yofs = self.vscroll.pos
    52         self.editbox.set_yofs(self.vscroll.pos)
    55         self.editbox.redraw()
    53         self.editbox.redraw()
    56 
    54