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.


    Pythonista View Sidebar

    Pythonista
    3
    12
    2222
    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 @DavinE last edited by mikael

      @DavinE, the error comes from anchors, and I have seen similar when a view does not have a superview.

      In this case the problem is likely with how you ”throw away” the sidebar when you recreate it.

      This tells me I should add a convenience method that you can call to remove all anchors for a view and its subviews.

      But in any case, I would suggest having two different sidebars, one for customers and one for orders, not throwing them away but hiding them, and using a ui.TableView for their contents, as you would then get scrolling and editing options for free.

      DavinE 3 Replies Last reply Reply Quote 0
      • DavinE
        DavinE @mikael last edited by DavinE

        @mikael said:

        But in any case, I would suggest having two different sidebars, one for customers and one for orders, not throwing them away but hiding them, and using a ui.TableView for their contents, as you would then get scrolling and editing options for free.

        okay i tried it with an ui.TableView

        In this case the problem is likely with how you ”throw away” the sidebar when you recreate it.

        That would be nice and i think a bit easier

        Thanks :D

        @mikael EDIT:
        Is it possible That you can show me an example?
        I dont get it... its always the same error or it pops both views up :(

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

          @mikael said:

          But in any case, I would suggest having two different sidebars, one for customers and one for orders, not throwing them away but hiding them, and using a ui.TableView for their contents, as you would then get scrolling and editing options for free.

          But how it works when i make more pages like..

          1. Startpage
          2. Add User
          3. etc....

          how can i close here my pages or is it then same like this:

          self.root.remove_subview(view) ?

          or is it here special

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

            @DavinE, you can have two sidebars, and move the one you do not need outside the screen, or both when you want to show the main content only.

            If you have several pages, you can also consider ui.NavigationView for paging.

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

              @mikael i found an working solution for me ;) ^^

              i have an other Question... about Labels

              when i use the label like:

              size_to_fit(ui.Label(name='welcomeLabel', text='a very long text.........'))
              size_to_fit(ui.Label(name='welcomeLabel', text='a very long **\n** text.........'))
              

              on small Devices my text is cutted on both examples....
              do you have an solution for me :D ^^

              thanks and regards

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

                It seems to me that your options are to either change the font smaller, or text wrap it so it takes up more lines, fewer columns. The textwrap module has a wrap function that is good for limiting text to some number of columns. I'm sure there is probably a iOS objc way to do the same, within the text view inside the button...

                Buttons with really long text are not really the way iOS designs are supposed to be made... Usually there is a better way.

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

                  @DavinE, ui.Label has a standard feature where you set number_of_lines to 0, and it will wrap to as many lines as are needed.

                  It is often convenient to set the width to something suitable, then call size_to_fit to make the height fit the amount of text you have.

                  Many different font sizes on one UI can be ugly, but if that is not a concern, you can also have a loop where you use ui.measure_string to check if the text fits, and make the font size smaller if not.

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

                    @JonB Thanks for your Reply but @mikael have the solution....

                    It is often convenient to set the width to something suitable, then call size_to_fit to make the height fit the amount of text you have.

                    i tried so many things but to call Size_to_fit after that...
                    crap---

                    thanks @mikael !!

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

                      @mikael said:

                      @DavinE, the error comes from anchors, and I have seen similar when a view does not have a superview.

                      In this case the problem is likely with how you ”throw away” the sidebar when you recreate it.

                      This tells me I should add a convenience method that you can call to remove all anchors for a view and its subviews.

                      @mikael
                      Did you do that for anchors ?

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

                        @DavinE, do you mean an anchor removal method? I think I did not. Do you need it?

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

                          @mikael maybe it's a better way to remove Sidebars ?
                          In my case i get often errors when i Rotate my iPhone (this is solved with your code in my other Post) or iPad
                          or an other example when i close the Sidebar and reopen it i'll get en error too..
                          so at the moment i don't close the View i put it away form the main view

                          only when it's not a lot of Work for you ;)

                          i Hope you understand what i want ^^
                          or need i do an Example ? (when i can reproduce it)

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