Hybrid View

  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    11
    Vote Rating
    0
    ekf is on a distinguished road

      0  

    Default Unanswered: TitleBar text truncation is not updated when the toolbar is hidden

    Unanswered: TitleBar text truncation is not updated when the toolbar is hidden


    I have a TitleBar with several buttons. If the screen is not wide enough to fit the title and the buttons, it will rightly truncate the title, e.g. if the title is "My Long Title":

    [BUTTON] My Lon... [BUTTON]

    However, let's say the screen is in landscape mode and it can fit the whole title. Then, I hide the toolbar, rotate the device, and show the toolbar. Now it can't fit the whole title, but it is not updated so the title overlaps one of the buttons.

    Is this a bug? Or if it's by design, then how I can I override the behavior so that it will update the toolbar when I show it?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,397
    Answers
    3549
    Vote Rating
    849
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The TitleBar has to calculate the width of the text but when it's hidden it doesn't really have a width.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    11
    Vote Rating
    0
    ekf is on a distinguished road

      0  

    Default


    So how do I get it to recalculate the text width after I show it?

  4. #4
    Sencha User
    Join Date
    Mar 2012
    Location
    The Netherlands
    Posts
    75
    Answers
    13
    Vote Rating
    4
    SebasSP is on a distinguished road

      0  

    Default


    I believe the private method refreshTitlePosition() does what you want. In my case i had to call it with a small delay after showing the titlebar. Please mind that the use of private methods of ST is discouraged.
    http://docs.sencha.com/touch/2-0/#!/api/Ext.TitleBar-method-refreshTitlePosition

  5. #5
    Ext JS Premium Member
    Join Date
    Oct 2010
    Location
    West Germany
    Posts
    55
    Vote Rating
    4
    olegtaranenko is on a distinguished road

      0  

    Default


    Do update to ST 2.1

    Cheers, Oleg