FUNCTION PAGE2( oFld )
LOCAL oGet1, cGet1 := "??????????"
LOCAL cKey1 := "? ", oSay[3], oAsc
@ 5, 25 SAY oSay[1] PROMPT "V-KEY-Table" ;
OF oFld:aDialogs[ 2 ] SIZE 120, 25 FONT oFont3 PIXEL UPDATE
oSay[1]:lTransparent := .T.
oSay[1]:SetColor( nFTColor, ) // 8454143, )
DBSELECTAREA(2)
DBGOTOP()
@ 30, 25 XBROWSE oBrw2 SIZE 265, 178 PIXEL OF oFld:aDialogs[ 2 ]
oBrw2:nMarqueeStyle := MARQSTYLE_SOLIDCELL
oBrw2:nColDividerStyle := LINESTYLE_BLACK
oBrw2:nRowDividerStyle := LINESTYLE_BLACK
oBrw2:bClrSelFocus = { || { 0, 16512957 } }
oBrw2:bClrSel = { || { 16777215, 255 } }
oBrw2:nRecSelColor = 15512898
oBrw2:lHScroll := .F.
oBrw2:lVScroll := .T.
oBrw2:lFooter := .F.
oBrw2:nRowHeight := 25
oBrw2:lColChangeNotify := .T.
// 1
oCol := oBrw2:AddCol()
oCol:bStrData := { || (2)->KEY1 }
oCol:bOnPostEdit = { | oCol, xVal, nKey | IIF ( nKey == VK_RETURN .and. NET_RLOCK( 5, 5 ), ;
( (2)->KEY1 := xVal, ;
NET_ULOCK(), oBrw2:Refresh() ), NIL) }
// 2
oCol := oBrw2:AddCol()
oCol:bStrData := { || (2)->VALUE1 }
oCol:bOnPostEdit = { | oCol, xVal, nKey | IIF ( nKey == VK_RETURN .and. NET_RLOCK( 5, 5 ), ;
( (2)->VALUE1 := xVal, ;
NET_ULOCK(), oBrw2:Refresh() ), NIL) }
// 3
oCol := oBrw2:AddCol()
oCol:bStrData := { || (2)->KEY2 }
oCol:bOnPostEdit = { | oCol, xVal, nKey | IIF ( nKey == VK_RETURN .and. NET_RLOCK( 5, 5 ), ;
( (2)->KEY2 := xVal, ;
NET_ULOCK(), oBrw2:Refresh() ), NIL) }
// 4
oCol := oBrw2:AddCol()
oCol:bStrData := { || (2)->VALUE2 }
oCol:bOnPostEdit = { | oCol, xVal, nKey | IIF ( nKey == VK_RETURN .and. NET_RLOCK( 5, 5 ), ;
( (2)->VALUE2 := xVal, ;
NET_ULOCK(), oBrw2:Refresh() ), NIL) }
// 5
oCol := oBrw2:AddCol()
oCol:bStrData := { || (2)->KEY3 }
oCol:bOnPostEdit = { | oCol, xVal, nKey | IIF ( nKey == VK_RETURN .and. NET_RLOCK( 5, 5 ), ;
( (2)->KEY3 := xVal, ;
NET_ULOCK(), oBrw2:Refresh() ), NIL) }
// 6
oCol := oBrw2:AddCol()
oCol:bStrData := { || (2)->VALUE3 }
oCol:bOnPostEdit = { | oCol, xVal, nKey | IIF ( nKey == VK_RETURN .and. NET_RLOCK( 5, 5 ), ;
( (2)->VALUE3 := xVal, ;
NET_ULOCK(), oBrw2:Refresh() ), NIL) }
i := 1
FOR i := 1 TO LEN( oBrw2:aCols )
WITH OBJECT oBrw2:aCols[i]
oBrw2:aCols[i]:oHeaderFont := oFont2
oBrw2:aCols[i]:bClrHeader := { || { 128,0 } }
oBrw2:aCols[i]:oDataFont := oFont2
oBrw2:aCols[i]:nEditType = EDIT_GET
IF I = 1 .or. I = 3 .or. I = 5
oBrw2:aCols[i]:nWidth := 105
oBrw2:aCols[i]:cEditPicture := '!!!!!!!!!!'
oBrw2:aCols[i]:cHeader := "VK_"
// oBrw2:aCols[i]:SetAlign( AL_CENTER )
oBrw2:aCols[i]:bClrstd := {|| { nBTColor1, nBColor1 } }
ELSE
oBrw2:aCols[i]:nWidth := 50
oBrw2:aCols[i]:cEditPicture := 'XXX'
oBrw2:aCols[i]:cHeader := "ASC"
oBrw2:aCols[i]:bClrstd := {|| { nBTColor2, nBColor2 } }
ENDIF
END
NEXT
oBrw2:CreateFromCode()
oBrw2:bLClicked := { | nRow, nCol | ( nRPos := oBrw2:KeyNo(), ;
nCPos := oBrw2:SelectedCol():nCreationOrder, ;
SEL_VKEYS(nRPos,nCPos, oGet1, oAsc) ) }
oBrw2:bChange := { | nRow, nCol | ( nRPos := oBrw2:KeyNo(), ;
nCPos := oBrw2:SelectedCol():nCreationOrder, ;
SEL_VKEYS(nRPos,nCPos, oGet1, oAsc) ) }
@ 5, 125 SAY oSay[2] PROMPT "Key :" ;
OF oFld:aDialogs[ 2 ] SIZE 40, 25 FONT oFont3 PIXEL UPDATE
oSay[2]:lTransparent := .T.
oSay[2]:SetColor( nFTColor, )
@ 4, 170 GET oGet1 VAR cGet1 PICTURE "!!!!!!!!!!" ;
SIZE 105, 20 OF oFld:aDialogs[ 2 ] PIXEL FONT oFont3 UPDATE
oGet1:bChange = { |n,f,oGet| cKey1 := SHOW_VKEYS( TRIM( oGet1:oGet:Buffer ) ), ;
oBrw2:nRowSel := (2)->(ORDKEYNO()), ;
oBrw2:Refresh(), oAsc:Refresh() }
oGet1:bGotFocus := {|| cGet1 := SPACE(10), aTable2 := {}, oGet1:Refresh(), ;
cKey1 := "? ", oAsc:Refresh() }
@ 5, 280 SAY oSay[3] PROMPT "->" ;
OF oFld:aDialogs[ 2 ] SIZE 30, 25 FONT oFont3 PIXEL UPDATE
oSay[3]:lTransparent := .T.
oSay[3]:SetColor( nFTColor, )
@ 5, 300 SAY oAsc PROMPT cKey1 ;
OF oFld:aDialogs[ 2 ] SIZE 60, 25 FONT oFont3 PIXEL UPDATE
oAsc:lTransparent := .T.
oAsc:SetColor( nDTColor, )
RETURN NIL
// ------------------
FUNCTION SHOW_VKEYS(cKey)
LOCAL cKeySearch := "? "
LOCAL nKey := LEN(cKey)
DBSELECTAREA(2)
DBGOTOP()
DO WHILE !EOF()
IF cKey = SUBSTR((2)->KEY1, 1, nKey)
cKeySearch := (2)->VALUE1
EXIT
ENDIF
IF cKey = SUBSTR((2)->KEY2, 1, nKey)
cKeySearch := (2)->VALUE2
EXIT
ENDIF
IF cKey = SUBSTR((2)->KEY3, 1, nKey)
cKeySearch := (2)->VALUE3
EXIT
ENDIF
DBSKIP(+1)
ENDDO
RETURN ( cKeySearch )
// ------------------
FUNCTION SEL_VKEYS(nRPos,nCPos, oGet1, oAsc)
// MsgAlert( nCPos, "Col-position" )
IF nCPos = 1 .or. nCpos = 2
oGet1:cText( (2)->KEY1 )
oAsc:SetText( (2)->VALUE1 )
ENDIF
IF nCPos = 3 .or. nCpos = 4
oGet1:cText( (2)->KEY2 )
oAsc:SetText( (2)->VALUE2 )
ENDIF
IF nCPos = 5 .or. nCpos = 6
oGet1:cText( (2)->KEY3 )
oAsc:SetText( (2)->VALUE3 )
ENDIF
RETURN NIL