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.


    Disable sub view = disable object in it automatically?

    Pythonista
    disable view
    2
    3
    1562
    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.
    • sendog3c
      sendog3c last edited by

      I want to disable a sub view, if I do that automatically all the buttons, textfield will be disable too.

      Thanks.

      mikael 1 Reply Last reply Reply Quote 0
      • mikael
        mikael @sendog3c last edited by mikael

        @sendog3c, this seems to work:

        view.objc_instance.setEnabled_(False)
        

        ... although the contained elements do not show the visual cues of being disabled (e.g. greyed-out text), so there is little practical difference to just setting:

        view.touch_enabled = False
        

        If the visual cues are important to you, I suggest writing a little utility function that loops through the subviews of a view and sets the value of the enabled property, if it exists (use hasattr), or touch_enabled otherwise.

        1 Reply Last reply Reply Quote 1
        • sendog3c
          sendog3c last edited by

          Thank you Maikel let me to digest it 🤭🤭🤭😂😂😂😂😂, before implement

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors