|
|
 | | From: | Jim Sare [dBVIPS] | | Subject: | Grid.rowSelect = true and Keyboard Navigation Causes Grid to Lose | | Date: | Wed, 05 Jan 2005 06:20:08 -0500 |
|
|
 | When grid.rowSelect is toggled to true while form is running, using keyboard keys to navigate in the Grid causes the Grid to lose input focus which causes keyboard keys to become nonfunctional.
Portion 1: - Run the form below my sig. - Click the CheckBox to set the Grid.rowSelect = true. - Tab into the Grid. - Use the keyboard up/down arrow keys to navigate rows. - Note that continued navigation is not possible with repeated key presses. - Note also that the Esc key now will not work to close the form. - Left-click the form with the mouse. - Use the keyboard up/down arrow keys to navigate. - The Grid will navigate on first key press and then lose input focus causing the keyboard keys to again go dead.
Portion 2: - Edit the form and uncomment the Grid.onLostFocus function pointer assignment which implements a workaround which further demonstrates the cause of the bug. - Run the form. - Note that now continued key presses will navigate the rows in the Grid and the Esc key will close the form.
Note also that the Grid appears to not lose input focus if Grid.rowSelect is set to true in the definition of the Grid during form instantiation. The Grid only appears to lose input focus on navigation from the keyboard if Grid.rowSelect is toggled to true while the form is running.
Tested on XP Home in current PLUS release and 7.01 (b1419) and 7.5 (b1477) and behavior is the same (bug exists in the old releases too).
Also, although the incorporated workaround appears to work, I don't have a high degree of faith in it because the workaround relies on the form.onGotFocus/onLostFocus and Grid.onLostFocus events. The focus events are questionable at best for implementing reliable workarounds due to Windows event mechanisms not being reliable for focus-based events (based on past experiences) and due to notorious interaction of focus-based events. -- Jim Sare - [dBVIPS] http://www.jimsare.com ======================================================= ** END HEADER -- do not remove this line // // Generated on 01/05/2005 // parameter bModal local f f = new escexitForm() if (bModal) f.mdi = false // ensure not MDI f.readModal() else f.open() endif
class escexitForm of FORM with (this) onGotFocus = {; this.hasFocus := true} onLostFocus = {; this.hasFocus := false} onOpen = {; this.hasFocus = this.enabled and this.visible} onLeftMouseDown = class::FORM_ONLEFTMOUSEDOWN metric = 6 // Pixels height = 409.0 left = 191.0 top = 0.0 width = 458.0 text = "" endwith
this.DBASESAMPLES1 = new DATABASE() this.DBASESAMPLES1.parent = this with (this.DBASESAMPLES1) left = 109.0 top = 2.0 databaseName = "DBASESAMPLES" active = true endwith
this.FISH1 = new QUERY() this.FISH1.parent = this with (this.FISH1) left = 191.0 top = 1.0 database = form.dbasesamples1 sql = "select * from fish.dbf" active = true endwith
with (this.FISH1.rowset) onNavigate = {; this.parent.parent.setFocus()} endwith
this.ENTRYFIELD1 = new ENTRYFIELD(this) with (this.ENTRYFIELD1) dataLink = form.fish1.rowset.fields["name"] height = 22.0 left = 70.0 top = 22.0 width = 259.0 endwith
this.GRID1 = new GRID(this) with (this.GRID1) // Uncomment following line to implement workaround // onLostFocus = class::GRID1_ONLOSTFOCUS dataLink = form.fish1.rowset cellHeight = 22.0 height = 253.0 left = 42.0 top = 77.0 width = 392.0 endwith
this.CHECKBOX1 = new CHECKBOX(this) with (this.CHECKBOX1) onChange = {; form.grid1.rowselect := this.value} onOpen = {; this.value := form.grid1.rowselect} height = 24.0 left = 168.0 top = 352.0 width = 112.0 text = "&Grid.rowselect" endwith
this.rowset = this.fish1.rowset
PROCEDURE GRID1_onLostFocus
// Workaround for Grid bug where Grid loses input focus when // Grid.rowSelect = true which causes Grid to lose input focus // on row navigation using arrow keys to navigate in the Grid. // NOTE: This loss of focus also causes the Esc key (and other // keys) to become nonfunctional as well. if form.hasFocus and this.rowSelect and; (not empty(form.activeControl)) and; (form.activeControl.name == this.name) this.setFocus() endIf
PROCEDURE form_onLeftMouseDown(flags, col, row)
// If workaround (Grid.onLostFocus function pointer assignment) // is commented, left-click the form to refocus the Grid as // further demonstration of bug being caused by loss of // input focus to Grid. ? empty(this.activeControl) if not empty(this.activeControl) this.activeControl.setFocus() endIf
endclass =======================================================
|
|
 | | From: | Bruce Beacham | | Subject: | Re: Grid.rowSelect = true and Keyboard Navigation Causes Grid to | | Date: | Wed, 05 Jan 2005 12:31:10 +0000 |
|
|
 | Jim Sare [dBVIPS] wrote:
> > When grid.rowSelect is toggled to true while form is running, using > keyboard keys to navigate in the Grid causes the Grid to lose input > focus which causes keyboard keys to become nonfunctional.
There is an existing bug report for this, submitted in Feb 2003, but as I can't search the bug report database (there's a bug...) I can't tell you the QAID.
Bruce Beacham
|
|
 | | From: | Marty Kay | | Subject: | Re: Grid.rowSelect = true and Keyboard Navigation Causes Grid to Lose Input Focus | | Date: | Sun, 16 Jan 2005 22:07:38 -0500 |
|
|
 | The existing bug report for this is QAID: 3700
I have added your test case to the bug report.
Thanks,
- Marty Kay (dBI) -
"Jim Sare [dBVIPS]" wrote in message news:C4idEjx8EHA.1736@news-server... > > When grid.rowSelect is toggled to true while form is running, using > keyboard keys to navigate in the Grid causes the Grid to lose input > focus which causes keyboard keys to become nonfunctional. > > Portion 1: > - Run the form below my sig. > - Click the CheckBox to set the Grid.rowSelect = true. > - Tab into the Grid. > - Use the keyboard up/down arrow keys to navigate rows. > - Note that continued navigation is not possible with > repeated key presses. > - Note also that the Esc key now will not work to close the > form. > - Left-click the form with the mouse. > - Use the keyboard up/down arrow keys to navigate. > - The Grid will navigate on first key press and then lose > input focus causing the keyboard keys to again go dead. > > Portion 2: > - Edit the form and uncomment the Grid.onLostFocus function > pointer assignment which implements a workaround which > further demonstrates the cause of the bug. > - Run the form. > - Note that now continued key presses will navigate the rows > in the Grid and the Esc key will close the form. > > Note also that the Grid appears to not lose input focus if > Grid.rowSelect is set to true in the definition of the Grid during form > instantiation. The Grid only appears to lose input focus on navigation > from the keyboard if Grid.rowSelect is toggled to true while the form is > running. > > Tested on XP Home in current PLUS release and 7.01 (b1419) and > 7.5 (b1477) and behavior is the same (bug exists in the old releases too). > > Also, although the incorporated workaround appears to work, I don't have > a high degree of faith in it because the workaround relies on the > form.onGotFocus/onLostFocus and Grid.onLostFocus events. The focus > events are questionable at best for implementing reliable workarounds > due to Windows event mechanisms not being reliable for focus-based > events (based on past experiences) and due to notorious interaction of > focus-based events. > -- > Jim Sare - [dBVIPS] > http://www.jimsare.com > ======================================================= > ** END HEADER -- do not remove this line > // > // Generated on 01/05/2005 > // > parameter bModal > local f > f = new escexitForm() > if (bModal) > f.mdi = false // ensure not MDI > f.readModal() > else > f.open() > endif > > class escexitForm of FORM > with (this) > onGotFocus = {; this.hasFocus := true} > onLostFocus = {; this.hasFocus := false} > onOpen = {; this.hasFocus = this.enabled and this.visible} > onLeftMouseDown = class::FORM_ONLEFTMOUSEDOWN > metric = 6 // Pixels > height = 409.0 > left = 191.0 > top = 0.0 > width = 458.0 > text = "" > endwith > > this.DBASESAMPLES1 = new DATABASE() > this.DBASESAMPLES1.parent = this > with (this.DBASESAMPLES1) > left = 109.0 > top = 2.0 > databaseName = "DBASESAMPLES" > active = true > endwith > > this.FISH1 = new QUERY() > this.FISH1.parent = this > with (this.FISH1) > left = 191.0 > top = 1.0 > database = form.dbasesamples1 > sql = "select * from fish.dbf" > active = true > endwith > > with (this.FISH1.rowset) > onNavigate = {; this.parent.parent.setFocus()} > endwith > > this.ENTRYFIELD1 = new ENTRYFIELD(this) > with (this.ENTRYFIELD1) > dataLink = form.fish1.rowset.fields["name"] > height = 22.0 > left = 70.0 > top = 22.0 > width = 259.0 > endwith > > this.GRID1 = new GRID(this) > with (this.GRID1) > // Uncomment following line to implement workaround > // onLostFocus = class::GRID1_ONLOSTFOCUS > dataLink = form.fish1.rowset > cellHeight = 22.0 > height = 253.0 > left = 42.0 > top = 77.0 > width = 392.0 > endwith > > this.CHECKBOX1 = new CHECKBOX(this) > with (this.CHECKBOX1) > onChange = {; form.grid1.rowselect := this.value} > onOpen = {; this.value := form.grid1.rowselect} > height = 24.0 > left = 168.0 > top = 352.0 > width = 112.0 > text = "&Grid.rowselect" > endwith > > this.rowset = this.fish1.rowset > > PROCEDURE GRID1_onLostFocus > > // Workaround for Grid bug where Grid loses input focus when > // Grid.rowSelect = true which causes Grid to lose input focus > // on row navigation using arrow keys to navigate in the Grid. > // NOTE: This loss of focus also causes the Esc key (and other > // keys) to become nonfunctional as well. > if form.hasFocus and this.rowSelect and; > (not empty(form.activeControl)) and; > (form.activeControl.name == this.name) > this.setFocus() > endIf > > PROCEDURE form_onLeftMouseDown(flags, col, row) > > // If workaround (Grid.onLostFocus function pointer assignment) > // is commented, left-click the form to refocus the Grid as > // further demonstration of bug being caused by loss of > // input focus to Grid. > ? empty(this.activeControl) > if not empty(this.activeControl) > this.activeControl.setFocus() > endIf > > endclass > =======================================================
|
|
|