omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Touch_Moved in panel view

    Pythonista
    1
    1
    761
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JonB
      JonB last edited by

      I've been having troubles implementing custom touch handlers for a view that is presented as a panel or sidebar. Fullscreen, popover and sheet work ok.

      While touch_moved does get dispatched once for panel/sidebar, that's it, and after that the window starts to drag (to drag the editor or cinsole back into view)

      I'm not sure what the right behaviour should be, but perhaps if a view implements custom touch handling, that handling should take precedence? Or, maybe drag between editor/etc should only be in main title bar? Or maybe some sort of command or property that disables default touch handling?

      See the simple example below, which turns green when dragging. It works as expected for sheet, popover, or fullscreen

      import ui.View
      class myview(ui.View):
          def __init__(self):
              self.bg_color=(1,0,0)
          def touch_moved(sender,touch):
              ui.cancel_delays()
              sender.bg_color=(0,1,0)
              def red():
                  sender.bg_color=(1,0,0)
              ui.delay(red,0.05)
      myview().present('panel')
      
      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Powered by NodeBB Forums | Contributors