0

focusOnCompletion / Loss of Focus Issue

Hey all,

I'm having an issue invoking the focusOnCompletion property of KONtx.dialogs.Alerts. I have a list of items presented in a container. Selecting one of these items will prompt the user for a confirmation, and delete the item if the user approves. The problem is that the widget loses focus after that -- users will have to close and reopen the Konfabulator layer to return to the Widget.

I am a new WDK developer recently added to our team, and I'm a little lost on why this is happening. I've attempted to use focusOnCompletion, as well as simply using focus(); on an element after the grid refreshes. I've tried multiple elements, including containers, buttons, grids, etc. Nothing seems to work yet.

Here's my code,

CODE
        var removePanel = new KONtx.element.Container({
styles: {
height: removeHeight,
width: this.width,
vOffset: removeLocation.outerHeight
}
}).appendTo(panel);

this.refreshGrid = function() {
removePanel.removeChild(this.cityGridList);
removePanel.removeChild(this.cityGridListIndic);

this.cityGridList = new KONtx.control.FillGrid({
rows: 9,
columns: 1,
orientation: 'horizontal',
dataSet: MYWIDG.cityButtonList,
render: true,
styles: {
width: this.width,
height: removeHeight - indicatorHeight,
vOffset: 0,
background: 'black'
},
renderMethod: function(config) {
config = $merge({
styles: {
color: '#FFFFFF',
height: buttonHeight,
background: 'black'
},
events: {
onSelect: function(type, args, obj) {
if (MYWIDG.cityButtonList.length > 1) {
var self = this;
MYWIDG.alertDialog({
title: $_('remove_location'),
message: 'Are you sure you want to remove "' + this.locationName + '"?',
focusOnCompletion: MYWIDG.removePanel,
buttons: [
{
label: $_('remove_location'),
callback: function(config) {
var cityIndex = MYWIDG.cityList.indexOf(self.locationID);
MYWIDG.cityButtonList.splice(cityIndex, 1);
MYWIDG.cityList.splice(cityIndex, 1);

try{
controller.cityGridList.deleteItems(cityIndex);
MYWIDG.views.stack['menu'].cityGridList.deleteItems(cityIndex);
}
catch(error){
}

controller.refreshGrid();
try{
MYWIDG.views.stack['menu'].refreshGrid();
}
catch(e)
{}

MYWIDG.db.exec("DELETE FROM mydatabase WHERE code = '" + self.locationID + "'");

// Reset the views so that it doesnt go back to the location that was just deleted
MYWIDG.locationCode = MYWIDG.cityList[0];
MYWIDG.locationName = MYWIDG.cityButtonList[0].locationName;

var sid = 'weather_snippet_' + self.locationID;
MYWIDG.deleteSnippet([sid]);
MYWIDG.deleteSnippetConfs([sid]);

MYWIDG.views.stack['main_section'].getDataFeed();
}
},
{
label: 'Cancel'
}
]//END BUTTONS
}).fire();
} else {

}
}//end onselect
}//end events
}, config);//end renderMethod


Thanks for any help!

by
2 Replies
  • I've actually managed to resolve the issue, however now I'm noticing that our dialog boxes have an extra button. Always. It's always the last one, and it's always blank. I'm blaming the fact that the project was developed on an old version of the WDK/Framework. I'm going to recode it according to the newest documentation and see what comes of it.
    0
  • QUOTE (t.knapton @ Jun 11 2009, 11:28 AM) <{POST_SNAPBACK}>
    I've actually managed to resolve the issue, however now I'm noticing that our dialog boxes have an extra button. Always. It's always the last one, and it's always blank. I'm blaming the fact that the project was developed on an old version of the WDK/Framework. I'm going to recode it according to the newest documentation and see what comes of it.


    I've heard of that being an issue in the distant past, but I know it's resolved now. If fixing your code doesn't work, send us an email requesting the latest WDK.

    -Jeremy
    0

Recent Posts

in General - Yahoo! TV Widgets