|
row = il_ anchor_ row TO al_ row this.selectrow(l_row,TRUE) NEXT end if elseif KeyDown(KeyShift!) then SelectRow(0,FALSE) IF il_ anchor_ row > al_ row then FOR l_ row = il_ anchor_ row TO al_ row STEP -1 this.selectrow(l_ row,TRUE) NEXT else FOR l_ row = il_ anchor_ row TO al_ row this.selectrow(l_row,TRUE) NEXT end if b_ reset_ anchor = FALSE elseif Keydown(KeyControl!) then SelectRow( al_row, NOT IsSelected( al_row ) ) else SelectRow(0,FALSE) SelectRow(al_ row,TRUE) end ifEND CHOOSESetRedraw(TRUE)if b_ reset_ anchor then il_ anchor_ Row = al_ rowreturn 0现在,要执行行选择时,只需调用uf_ProcessSelect()函数。一般当用户在一个数据窗口中点击了鼠标或是按下了上、下箭头键时,调用这个函数。另外还有捕获home和end键的代码。下面是we_keydown用户事件映射到Pbm_dwnkey事件中的代码: Event: we_ keydown (pbm_dwnkey) Object: Any DataWindow if KeyDown(KeyDownArrow!) and GetRow() <> RowCount() then uf_ processSelect( GetRow() + 1 , "Keyboard") elseif KeyDown(KeyUpArrow!) and GetRow() <> 1 then uf_ processSelect( GetRow() - 1 , "Keyboard") elseif KeyDown(KeyHome!) and RowCount() > 0 then uf_ processSelect( 1, "KeyBoard") elseif KeyDown(KeyEnd!) and RowCount() > 0 then uf_ processSelect( RowCount(), "Keyboard") end if最后,我们需要在clicked事件中加入: uf_ processSelect(GetClickedRow(), "Mouse")在这个祖先函数中编写这样一个行选择的函数只是作为一个简单的实例,相信读者一定能因此受到启发,编写出更多的函数,以拓展数据窗口的基本功能。
上一页 [1] [2] [3]
|