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.


    content_inset for TextView

    Pythonista
    3
    5
    2329
    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.
    • mikael
      mikael last edited by

      TextView seems to inherit or proxy content_inset from ScrollView, but it does not work for me. Something like the correct inset is briefly flashed, then the view moves to default insets.

      I am running 1.6 beta on 6s Plus with 9.2. Here's my test case:

      #coding: utf-8
      import ui
      
      init_text = '''
      Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum
      
      Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum
      '''
      
      tv = ui.TextView()
      tv.text = init_text
      tv.content_inset = (30, 50, 30, 15)
      tv.present()
      #tv.content_inset = (30, 50, 30, 15)
      

      Could someone confirm/deny this behavior?

      Thanks,
      Mikael

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

        @mikael , I see it jumping on my ipad. But look I haven't done much work with TextView...
        But if you do the following, does it help?

        tv = ui.TextView(frame = (0,0,500,500))
        tv.auto_content_inset = False
        # then the code you had 
        
        1 Reply Last reply Reply Quote 0
        • mikael
          mikael last edited by

          Thanks, you are quite right.

          Turning auto_content_inset off does stop the jumping. Counterintuitive that these two settings should be related, as I am not even editing the text.

          Also painful that the content insets seem to be applied outside the original frame, rather than squeezing the content in.

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

            @mikael , but I am sure you saved a future issue for me 😁

            1 Reply Last reply Reply Quote 0
            • JonB
              JonB last edited by

              Try setting the content after you set the frame. or, have your tv as a subview to another view, and turn off flex. Your frame size changes when you call present, which likely is why the inset changes, and why you are notnhappy with the current approach.

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