Hi everyone!
i have a little xbrowse contribution
now we can select move direction to next cell post edition
open xbrowse.ch
( add )
the diference between FAST and other is FAST have fastedit feature when this is activated
when use no FAST with FastEdit activated, the "cursor" go to next cell whatever is editable or not
open xbrowse.prg
( add new data TXBrowse )
METHOD NEW Txbrowse
( add )
Change all METHOD GoNextCtrl TxBrwose
sample...
i have a little xbrowse contribution
now we can select move direction to next cell post edition
open xbrowse.ch
( add )
#define MOVE_RIGHT 1
#define MOVE_LEFT 2
#define MOVE_UP 3
#define MOVE_DOWN 4
#define MOVE_NONE 5
#define MOVE_FAST_RIGHT 6
#define MOVE_FAST_LEFT 7the diference between FAST and other is FAST have fastedit feature when this is activated
when use no FAST with FastEdit activated, the "cursor" go to next cell whatever is editable or not
open xbrowse.prg
( add new data TXBrowse )
DATA nMoveType; // 1 Move Right
AS NUMERIC // 2 Move Left
// 3 Move Up
// 4 Move down
// 5 No Move
// 6 Move Right with lFastedit features, only work with lFastEdit := .t.
// 7 Move left with lFastedit features, only work with lFastEdit := .t.METHOD NEW Txbrowse
( add )
::nMoveType := MOVE_FAST_RIGHTChange all METHOD GoNextCtrl TxBrwose
METHOD GoNextCtrl(hWnd) CLASS TXBrowse
local oCol
local aCols
local nCol, nNextPos, n
local lDir := .f.
local nI
local nOldMove
If hWnd != Nil
If ::nLastKey == 9
PostMessage(hWnd, WM_KEYDOWN, VK_RETURN)
Endif
return nil
Endif
if ::nColSel == ::nLastEditCol
::nLastEditCol := 0
if ::nLastKey == VK_DOWN
::Select( 0 )
::GoDown()
::Select( 1 )
elseif ::nLastKey == VK_UP
::Select( 0 )
::GoUp()
::Select( 1 )
else
if ::lFastEdit
DO CASE
CASE ::nMoveType == MOVE_FAST_RIGHT
nNextPos := 0
if ::nColSel < Len( ::aDisplay )
nNextPos := AScan( ::aDisplay, { |i| ::aCols[ i ]:nEditType > 0 }, ::nColSel + 1 )
endif
if nNextPos > 0
if ::IsDisplayPosVisible( nNextPos, .t. )
::nColSel := nNextPos
if ::FullPaint()
::Super:Refresh( .t. ) //::Paint()
else
::DrawLine( .t. )
endif
else
for n := ::nColSel + 1 to nNextPos
::GoRight()
next n
endif
else
::GoLeftMost()
nNextPos := AScan( ::aDisplay, { |i| ::aCols[ i ]:nEditType > 0 } )
if nNextPos > 1
if ::IsDisplayPosVisible( nNextPos, .t. )
::nColSel := nNextPos
::DrawLine( .t. )
else
for n := 2 to nNextPos
::GoRight()
next
endif
endif
if ::lAutoAppend .or. ::nDataRows > ::nRowSel
if ::bPastEof == NIL .and. ::nDataRows = ::nRowSel
MsgStop( "::bPastEof not defined","Fivewin: Class TXBrowse" )
return NIL
else
::Select( 0 )
::GoDown()
::Select( 1 )
endif
endif
endif
CASE ::nMoveType == MOVE_RIGHT
nNextPos := ::nColSel + 1
if !::IsDisplayPosVisible( nNextPos, .t. )
::GoLeftMost()
if ::nDataRows > ::nRowSel
::GoDown()
endif
else
::GoRight()
endif
CASE ::nMoveType == MOVE_FAST_LEFT
nNextPos := ::SelectedCol():nCreationOrder - 1
nI := nNextPos
if nNextPos > 0
while ::aCols[ nI ]:nEditType < 1
if ( --nI ) == 0
exit
endif
enddo
endif
nNextPos := ascan(::aDisplay,{|i| i = nI } )
if nNextPos > 0
if ::IsDisplayPosVisible( nNextPos, .t. )
::nColSel := nNextPos
if ::FullPaint()
::Super:Refresh( .t. ) //::Paint()
else
::DrawLine( .t. )
endif
endif
else
if nI > 0
for n := ::aDisplay[ ::nColSel ] - 1 to nI step -1
::GoLeft()
next n
else
::GoRightMost()
nI := len( ::aCols )
while ::aCols[ nI ]:nEditType < 1
if ( --nI ) == 0
exit
endif
enddo
nNextPos := ascan(::aDisplay,{|i| i = nI } )
if nNextPos > 0
if ::IsDisplayPosVisible( nNextPos, .t. )
::nColSel := nNextPos
::DrawLine( .t. )
else
for n := ::aDisplay[ ::nColSel ] - 1 to nI step -1
::GoLeft()
next n
endif
if ::nDataRows > 1
::GoUp()
endif
endif
endif
endif
CASE ::nMoveType == MOVE_LEFT
nNextPos := ::aDisplay[ ::nColSel ] - 1
if nNextPos > 0
::GoLeft()
else
::GoRightMost()
if ::nRowSel > 1
::GoUp()
endif
endif
CASE ::nMoveType == MOVE_DOWN
if ::lAutoAppend .and. ( ::nLen == 0 .or. ::eof() .or. ::KeyNo() == ::nLen )
if ::bPastEof == NIL .and. ::nDataRows = ::nRowSel
MsgStop( "::bPastEof not defined","Fivewin: Class TXBrowse" )
return NIL
else
::Select( 0 )
::GoDown()
::Select( 1 )
endif
else
::GoDown()
::refresh()
endif
CASE ::nMoveType == MOVE_UP
::GoUp()
::refresh()
ENDCASE
else
nOldMove := ::nMoveType
if ::nMoveType == MOVE_FAST_LEFT .or. ::nMoveType == MOVE_FAST_RIGHT
::nMoveType := MOVE_NONE
endif
DO CASE
CASE ::nMoveType == MOVE_RIGHT
::GoRight()
::refresh()
CASE ::nMoveType == MOVE_LEFT
::GoLeft()
::refresh()
CASE ::nMoveType == MOVE_DOWN
::GoDown()
::refresh()
CASE ::nMoveType == MOVE_UP
::GoUp()
::refresh()
ENDCASE
::nMoveType := nOldMove
endif
endif
endif
return nilsample...
#include "FiveWin.ch"
#include "xbrowse.ch"
function main()
local aArray1 := {}
local oWnd, ;
oMenu,;
oBrw
local nI
for nI = 1 to 20
aadd( aArray1, { "Row:"+StrZero(nI,2)+" Col:01",;
"Row:"+StrZero(nI,2)+" Col:02",;
"Row:"+StrZero(nI,2)+" Col:03",;
"Row:"+StrZero(nI,2)+" Col:04",;
"Row:"+StrZero(nI,2)+" Col:05",;
"Row:"+StrZero(nI,2)+" Col:06" } )
next
menu oMenu
menuitem "Movimientos"
menu
menuitem "MOVE_RIGHT" action oBrw:nMoveType := MOVE_RIGHT when oBrw:nMoveType != MOVE_RIGHT
menuitem "MOVE_LEFT" action oBrw:nMoveType := MOVE_LEFT when oBrw:nMoveType != MOVE_LEFT
menuitem "MOVE_UP" action oBrw:nMoveType := MOVE_UP when oBrw:nMoveType != MOVE_UP
menuitem "MOVE_DOWN" action oBrw:nMoveType := MOVE_DOWN when oBrw:nMoveType != MOVE_DOWN
menuitem "MOVE_NONE" action oBrw:nMoveType := MOVE_NONE when oBrw:nMoveType != MOVE_NONE
menuitem "MOVE_FAST_RIGHT" action oBrw:nMoveType := MOVE_FAST_RIGHT when oBrw:nMoveType != MOVE_FAST_RIGHT
menuitem "MOVE_FAST_LEFT" action oBrw:nMoveType := MOVE_FAST_LEFT when oBrw:nMoveType != MOVE_FAST_LEFT
endmenu
menuitem "FastEdit"
menu
menuitem "Activado" action oBrw:lFastEdit:=.t. when !oBrw:lFastEdit
menuitem "Desactivado" action oBrw:lFastEdit:=.f. when oBrw:lFastEdit
endmenu
endmenu
define window oWnd title "test" menu oMenu
oBrw:= txbrowse():new( oWnd )
oBrw:nRowHeight := 25
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:SetArray( aArray1 )
aeval( oBrw:aCols, {| o | o:nEditType := 1, o:bPopUp := { |o| ColMenu( o ) } } )
oBrw:CreateFromCode()
oWnd:oClient := oBrw
ACTIVATE window oWnd
return nil
static function ColMenu( ocol )
local oPop
MENU oPop POPUP 2007
MenuAddItem( "Edit", ,oCol:nEditType > 0, .t., ;
{ |oItem| oCol:nEditType := If( oCol:nEditType > 0, 0, 1 ), ;
oItem:SetCheck( oCol:nEditType > 0 ), ;
oCol:oBrw:SetFocus() } )
ENDMENU
return oPopour best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5Njk4MDc1OQ?src=global9
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5Njk4MDc1OQ?src=global9