Bug 280153. Often no visible focus when tree or list gets focus. r+a=mconnor

git-svn-id: svn://10.0.0.236/trunk@176548 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
aaronleventhal%moonset.net
2005-07-25 19:25:38 +00:00
parent e0de08bd63
commit bae8e7fa99
2 changed files with 26 additions and 2 deletions

View File

@@ -228,7 +228,7 @@
<property name="currentIndex">
<getter><![CDATA[
return this.getIndexOfItem(this.currentItem);
return this.currentItem ? this.getIndexOfItem(this.currentItem) : -1;
]]></getter>
<setter><![CDATA[
if (val >= 0)
@@ -504,6 +504,19 @@
</implementation>
<handlers>
<handler event="focus">
<![CDATA[
if (this.currentIndex == -1 && this.getRowCount() > 0) {
this.currentItem = getItemAtIndex(0); // focus first item
if (this.selType != 'multiple') {
// In single selection trees the selection should be the same
// as the focus
this.timedSelect(currentItem, this._selectDelay);
}
this.ensureIndexIsVisible(0);
}
]]>
</handler>
<handler event="keypress" keycode="vk_up" phase="target">
<![CDATA[
if (this.selectedItems.length < 1)

View File

@@ -246,7 +246,18 @@
this.treeBoxObject.scrollByLines(rows);
]]>
</handler>
<handler event="focus" action="this.treeBoxObject.focused = true;"/>
<handler event="focus">
<![CDATA[
this.treeBoxObject.focused = true;
if (this.currentIndex == -1 && this.view.rowCount > 0) {
this.currentIndex = 0;
if (this.view.selection.single) {
this.view.selection.select(0);
}
this.treeBoxObject.ensureRowIsVisible(0);
}
]]>
</handler>
<handler event="blur" action="this.treeBoxObject.focused = false;"/>
<handler event="keypress" keycode="vk_enter" action="this.changeOpenState(this.currentIndex);"/>
<handler event="keypress" keycode="vk_return" action="this.changeOpenState(this.currentIndex);"/>