0

onFocus and onBlur event

Hi!! I am new in this area. Button's onFocus and onBlur event are not working. plz help me. where i made mistake?

this.controls.button1 = new KONtx.control.TextButton({
label: $_('Film'),
guid: "button1",
events: {

onSelect: function(event) {
KONtx.application.loadView('view-Sub1');
}

onBlur: function(event) {
KONtx.application.loadView('view-Sub2');
}

},
styles: {
width: Theme.viewSpecs.SIDE_BAR.width,
height: KONtx.utility.scale(35),
vOffset: topContainer.height,
}
}).appendTo(this);

by
5 Replies
  • this.controls.button1 = new KONtx.control.TextButton({
    label: $_('Film'),
    guid: "button1",
    events: {
    onFocus: function(event) {
    var c1 = new KONtx.element.Image({
    src: "Images/960x540/d1.png",
    styles: {
    vAlign: "center",
    hAlign: "center",
    width: 295,
    height: 150,

    }
    }).appendTo(topContainer);
    },

    onSelect: function(event) {
    KONtx.application.loadView('view-Sub1', { foo: "films" });
    }
    },

    styles: {
    width: Theme.viewSpecs.SIDE_BAR.width,
    height: KONtx.utility.scale(35),
    vOffset: topContainer.height,
    }
    }).appendTo(this);
    0
  • QUOTE (DEEPKUMAR @ Oct 11 2010, 02:37 PM) <{POST_SNAPBACK}>
    CODE
    						
    onFocus: function(event) {
    var c1 = new KONtx.element.Image({
    src: "Images/960x540/d1.png",
    styles: {
    vAlign: "center",
    hAlign: "center",
    width: 295,
    height: 150,

    }
    }).appendTo(topContainer);
    },


    This is the portion that might be erroring out. Instead of appending to the DOM on every button select, try setting up one control and swapping the source. Also, onFocus does not receive an event and fire in the scope of the button, to get at the view, call this.getView().

    For example:

    CODE
    this.controls.image = new KONtx.element.Image({
    ...
    },
    this.controls.button1 = new KONtx.control.TextButton({
    ...
    onFocus: function(){
    var view = this.getView();
    view.controls.image.setSource(PATH_OR_URL_HERE);
    },
    ...
    },


    Does that help?
    Jim
    0
  • Another approach we have used.

    CODE
    this.controls.image = new KONtx.element.Image({
    ...
    },
    this.controls.button1 = new KONtx.control.TextButton({
    ...
    onFocus: function(){
    var view = this.getView();
    view.controls.image.visible = !(view.controls.image_other.visible = true);
    },
    onBlur: function(){
    var view = this.getView();
    view.controls.image.visible = !(view.controls.image_other.visible = false);
    },
    ...
    },
    0
  • Thank you guys.. you both are true.. i just thought if i used my code as i defined in first block, is this any bad effect in case when we try it on original TV? means yahoo will test the functionality of of all widgets then they will move it into their gallary. right? means at the testing time from yahoo will they check the code complexity? becasue the complex code will access API in more complex way.. do you understand what i mean to say?
    0
  • QUOTE (DEEPKUMAR @ Oct 18 2010, 07:44 AM) <{POST_SNAPBACK}>
    Thank you guys.. you both are true.. i just thought if i used my code as i defined in first block, is this any bad effect in case when we try it on original TV? means yahoo will test the functionality of of all widgets then they will move it into their gallary. right? means at the testing time from yahoo will they check the code complexity? becasue the complex code will access API in more complex way.. do you understand what i mean to say?


    Sorry for the late response. Yahoo! will check your applications functionality and report back any errors we find in the console report. Yahoo! will very rarely look into the code of your application unless we find something very strange or have a specific issue.
    0

Recent Posts

in Design / Interaction - Yahoo! TV Widgets