kopia lustrzana https://github.com/peterhinch/micropython-micro-gui
widgets/textbox.py Fix bug with encoder scrolling.
rodzic
ba46d98216
commit
765f7bd70c
|
@ -87,7 +87,7 @@ Text may be clipped to the width of the control or may be word-wrapped. If the n
|
|||
of lines of text exceeds the height available, scrolling may be performed \
|
||||
by calling a method.
|
||||
|
||||
Please use the increase and decrease buttons to scroll this text.
|
||||
Please use the increase and decrease buttons (or encoder) to scroll this text.
|
||||
'''
|
||||
|
||||
class TBUScreen(Screen):
|
||||
|
|
|
@ -129,7 +129,13 @@ class Textbox(LinearIO):
|
|||
self.start = max(0, min(line, len(self.lines) - self.nlines))
|
||||
self.draw = True # Cause a refresh
|
||||
|
||||
async def btnhan(self, button, up):
|
||||
def do_adj(self, button, val):
|
||||
if isinstance(button, int): # Using an encoder
|
||||
self.scroll(val)
|
||||
else:
|
||||
asyncio.create_task(self.btn_handler(button, val))
|
||||
|
||||
async def btn_handler(self, button, up): # Only runs if not using encoder
|
||||
self.scroll(-up)
|
||||
t = ticks_ms()
|
||||
d = 1
|
||||
|
|
Ładowanie…
Reference in New Issue