M5ez scrolling through lines on canvas?



  • @rop, I'm a little confused about scrolling contents printed to the screen. In the Github documentation of M5ez, under the heading "Printing to the canvas", it says that items printed to the canvas with ez.canvas.println will scroll. It could be the way I'm creating that submenu, or the buttons that I'm showing, but I don't see a way to scroll back up through those lines? In the Demo, printing to the canvas is in there, but merely shows an OK button and waits. How to create that menu, and have button A be an "up" button, B be an "OK", and C be a "down"? Is scrolling through those printed lines of text possible like that? I print events from Blynk to the canvas, it would be nice to be able to go back up to see more than what's on the screen... Thanks in advance!



  • Try examples/z-ezTimeLog and you'll see the display scroll. All it does is print the ezTime log info to the canvas instead of the Serial port. If you want to make a menu (which appears to be what you're doing here), just use the menu object, don't work with printing anything to the screen directly. Otherwise maybe explain better what you're trying to do.

    (Scrolling does need work, also on the documentation side. See here.)



  • Have the ezTimeLog example loaded up. It is printing lines at the bottom of the canvas, and shifting previously printed lines up, indeed just like a terminal screen watching serial output. I think I misunderstood the scrolling functionality as the ability to use buttons to go back through the history at the top that had already scrolled off the screen. I see in issue #24 you say "canvas.print creates a buffer in memory that stores every print until it has scrolled off the screen", so that's not the way it works - sorry for my confusion.

    Indeed, creating menu items that don't do anything would be a possible solution. I tried that early on, but found that once the menu was drawn (or run), it merely sits and waits for buttons. I have not tried creating a function that does an .addItem, then runs the menu again, and run that function with an .addEvent. I'll give that a try as soon as possible. Is there a limit to the number of menu items, other than memory constraints? If I'm successful getting the "menu" to redraw, I'll let you know, and I guess I'll see what the limits might be!

    Thanks so much, @rop, your work is very appreciated!!!