0

Add a variable on backButton

How to i manage to pass a variable on the select of a back button? should i redefine a function or extend the backbutton to create a custom button? And which function and how?

by
2 Replies
  • QUOTE (Gades @ Oct 28 2010, 05:38 AM) <{POST_SNAPBACK}>
    How to i manage to pass a variable on the select of a back button? should i redefine a function or extend the backbutton to create a custom button? And which function and how?

    This should get you started.

    - Ben
    0
  • That i know, the problem is that the control backbutton automatically handles the call to the previous view internally, so for having to pass a parameter with the back button it was necessary to redefine the backbutton to change that function, it took me sometime but i managed to do it, here's the code if someone else needs it
    CODE
    Theme.storage.add("MyBackButton", {
    renderSkin: function (state,w,h,args,theme){
    var ff = new Frame();
    ff.width = w;
    ff.height = h;

    if (state=='focused') {
    var focus = ff.appendChild( new Image() );
    focus.colorize = theme.colors.colorize;
    focus.src = this.sources.focus;
    }

    var body = ff.appendChild( new Image() );
    body.src = this.sources.body;

    return ff;
    },
    styles: {
    '1920x1080': {
    width: Theme.keys.sidebar.width,
    height: 51
    },
    '960x540': {
    width: Theme.keys.sidebar.width,
    height: 26
    }
    }[ Theme.keys.screen ],

    sources: {
    '1920x1080': {
    body: Theme.keys.root + 'ControlBackButton/back-body-prebuilt-588x50.png',
    focus: Theme.keys.root + 'ControlBackButton/back-focus-raw-88x50.png'
    },
    '960x540': {
    body: Theme.keys.root + 'ControlBackButton/back-body-prebuilt-294x25.png',
    //focus: Theme.keys.root + 'ControlBackButton/back-focus-raw-44x25.png'
    focus: Theme.keys.root + 'ControlBackButton/back-focus-solid-raw-44x25.png'
    }
    }[ Theme.keys.screen ]
    });
    Theme.storage.add("MyBackButtonText", {

    styles: {
    '1920x1080': {
    width: Theme.keys.sidebar.width - 100,
    truncation: 'end',
    vAlign: 'center',
    fontSize: 32,
    paddingBottom: 2,
    color: Theme.colors.text,
    hOffset: 100
    },
    '960x540': {
    width: Theme.keys.sidebar.width - 50,
    truncation: 'end',
    vAlign: 'center',
    fontSize: 16,
    paddingBottom: 2,
    color: Theme.colors.text,
    hOffset: 50
    }
    }[ Theme.keys.screen ],

    glow: {
    '960x540': new Glow( 0, 1, 2, 'black', 35 ),
    '1920x1080': new Glow( 0, 2, 4, 'black', 35 )
    }[ Theme.keys.screen ]

    });
    var custom = {};
    custom.controls = {
    MyBackButton: new KONtx.Class({
    ClassName: 'MyBackButton',
    Extends: KONtx.control.BackButton,
    _handleSelectEvent: function () {
    KONtx.application.previousView(".....here goes your params......");

    },
    })
    };
    0

Recent Posts

in Design / Interaction - Yahoo! TV Widgets