0

Back Button Truncation

Can I ask why your documentation states that text in the KONtx.control.BackButton will be truncated even though it isn't and I cannot find a way to make it so?

CODE
The back button extends and behaves like the KONtx.control.Button. This button takes the same parameters as a control text button, but automatically provides a specific graphic treatment from the theme. The back button has a chevron in it to indicate a history stack of previous views. Titles for the button are truncated with ellipses at an appropriate length. Creates a KONtx.element.Text object. The back button control fires an onSelect event upon receiving a keydown event with keyCode == 13 (OK on the remote control) and executes KONtx.application.previousView() to display the previous view.


Please explain how to get the text to truncate if it is possible. If it is not possible you should update your Developer Guide.

by
10 Replies
  • Then what happens when you set the text to a long string?
    0
  • works for me.

    Both of these truncated
    CODE
    	this.controls.backButton = new KONtx.control.BackButton({
    label: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    guid: 'ListView.backButton'
    }).appendTo(this);

    this.controls.backButton = new KONtx.control.BackButton({
    label: "THIS IS SOME REALLY LONG TEXT ITS STILL GOING STRONG",
    guid: 'ListView.backButton'
    }).appendTo(this);
    0
  • Doing what you did does work for me as well. My problem I think is actually a bug.

    createView: function(){

    this.controls.backButton = new KONtx.control.BackButton({
    label: $_("button_back"),
    }).appendTo(this);

    },

    updateView: function(){
    this.controls.backButton.setText(this.item.itemTitle);
    }

    It seems that after multiple calls to setText, in the updateView, truncation stops working when some titles don't need to be truncated and some do. I can produce it in both the simulator and my TV.
    0


  • This is my result.
    0
  • Okay... There is definitely a BUG, but I can get around it. I am passing this title in the "this.persist" from the previous view. If I use the following code it doesn't truncate long titles...

    this.controls.backButton.setText(this.persist.itemTitle);

    If I do this it still doesn't work...

    this.controls.backButton.setText(this.persist.itemTitle + "");

    But if I do this it works just fine.

    this.controls.backButton.setText(this.persist.itemTitle + " ");

    Is there a reason a string stored in the persist object would cause this? I can definitely produce it and get around it, but it make no sense to me why a string stored in the persist would do this and a straight string variable would not??? =(
    0
  • Interesting...just out of curiosity, what happens if you explicitly cast the itemTitle to a string like this:

    this.controls.backButton.setText(String(this.persist.itemTitle));

    Also, try printing out the type of the itemTitle like:

    print(typeof this.persist.itemTitle);
    0
  • Also, try:

    this.controls.backButton.setText("");
    this.controls.backButton.setText(this.persist.itemTitle);
    0
  • Tried that one first. ;) Even tried combination of Substrings. I did find removing the last character works. If I add the space and then remove it with a substring or trim, it still doesn't elipse, but if I chop the last character off totally it does work. I'm wondering if storing the string in the persist is "adding something" to the string. I cannot determine if there is something wrong with that last character or not from my debugging. =(
    0
  • Ps... String(this.persist.itemTitle) doesn't help either, but good suggestion. I didn't try that one.
    0
  • If it helps... This is the code that loads the view. The code is in an onSelect event of a Grid Cell, but it should have anything to do with this behavior.

    KONtx.application.loadView("view-AlbumContentView",
    {itemType:type,
    itemId:this.getView().objectList[this.originalButtonNumber].id,
    itemTitle:this.getView().objectList[this.originalButtonNumber].title});
    0

Recent Posts

in General - Yahoo! TV Widgets