Incremental xBrowse-ARRAY-search from GET ?
Posted: Fri Jun 14, 2013 12:31 pm
Hello,
I have a little problem :
I scan a Array for a result-
The results of Buttonaction and bKeydown are different using the same function.
The first image ( bkeydown is used ) returns the first array-result ( F1 )
The second from buttonaction is OK
Both are using the same function !!!
@ 4, 175 GET oGet1 VAR cGet1 PICTURE "!!!!!!!!!!" ;
SIZE 105, 20 OF oFld:aDialogs[ 2 ] PIXEL FONT oFont3 UPDATE
oGet1:bKeyDown := { | nKey, nFlags | ;
IIF( nKey == 13, ( nKey1 := GET_KEYS(ALLTRIM(cGet1)), oSay[4]:Refresh() ), NIL ) }oGet1:bGotFocus := {|| cGet1 := SPACE(10), aTable := {}, oGet1:Refresh() }
@ 30, 300 BTNBMP oBtn1 OF oFld:aDialogs[ 2 ] ;
SIZE 28, 40 PIXEL;
NOBORDER ;
PROMPT "&Show" ;
ACTION ( nKey1 := GET_KEYS(ALLTRIM(cGet1)), oSay[4]:Refresh() );
FILENAME c_path1 + "Help.Bmp" ;
FONT oFont2 2007 ;
TOP
oBtn1:lTransparent := .t.
oBtn1:cToolTip = { "Array " + CRLF + "result","nKey", 1, CLR_BLACK, 14089979 }
oBtn1:SetColor( 0, )
Best Regards
Uwe
I have a little problem :
I scan a Array for a result-
The results of Buttonaction and bKeydown are different using the same function.
The first image ( bkeydown is used ) returns the first array-result ( F1 )
The second from buttonaction is OK
Both are using the same function !!!
@ 4, 175 GET oGet1 VAR cGet1 PICTURE "!!!!!!!!!!" ;
SIZE 105, 20 OF oFld:aDialogs[ 2 ] PIXEL FONT oFont3 UPDATE
oGet1:bKeyDown := { | nKey, nFlags | ;
IIF( nKey == 13, ( nKey1 := GET_KEYS(ALLTRIM(cGet1)), oSay[4]:Refresh() ), NIL ) }oGet1:bGotFocus := {|| cGet1 := SPACE(10), aTable := {}, oGet1:Refresh() }
@ 30, 300 BTNBMP oBtn1 OF oFld:aDialogs[ 2 ] ;
SIZE 28, 40 PIXEL;
NOBORDER ;
PROMPT "&Show" ;
ACTION ( nKey1 := GET_KEYS(ALLTRIM(cGet1)), oSay[4]:Refresh() );
FILENAME c_path1 + "Help.Bmp" ;
FONT oFont2 2007 ;
TOP
oBtn1:lTransparent := .t.
oBtn1:cToolTip = { "Array " + CRLF + "result","nKey", 1, CLR_BLACK, 14089979 }
oBtn1:SetColor( 0, )
- Code: Select all Expand view
FUNCTION GET_KEYS(cGet1)
LOCAL I, nLen := LEN( ALLTRIM( cGet1 ) )
I := 1
nStart := 111 // F1 - 12
FOR I := 1 TO 24
nStart++
cNo := LTRIM(STR(I))
AADD(aTable, { "F" + cNo, nStart })
NEXT
AADD(aTable, { "LBUTTON", 1 })
AADD(aTable, { "RBUTTON", 2 })
AADD(aTable, { "CANCEL", 3 })
AADD(aTable, { "MBUTTON", 4 })
AADD(aTable, { "BACK", 8 })
AADD(aTable, { "TAB", 9 })
AADD(aTable, { "CLEAR", 12 })
AADD(aTable, { "RETURN", 13 })
AADD(aTable, { "SHIFT", 16 })
AADD(aTable, { "CONTROL", 17 })
AADD(aTable, { "MENU", 18 })
AADD(aTable, { "PAUSE", 19 })
AADD(aTable, { "CAPITAL", 20 })
AADD(aTable, { "ESCAPE", 27 })
AADD(aTable, { "SPACE", 32 })
AADD(aTable, { "PRIOR", 33 })
AADD(aTable, { "NEXT", 34 })
AADD(aTable, { "END", 35 })
AADD(aTable, { "HOME", 36 })
AADD(aTable, { "LEFT", 37 })
AADD(aTable, { "UP", 38 })
AADD(aTable, { "RIGHT", 39 })
AADD(aTable, { "DOWN", 40 })
AADD(aTable, { "SELECT", 41 })
AADD(aTable, { "PRINT", 42 })
AADD(aTable, { "EXECUTE", 43 })
AADD(aTable, { "SNAPSHOT", 44 })
AADD(aTable, { "INSERT", 45 })
AADD(aTable, { "DELETE", 46 })
AADD(aTable, { "HELP", 47 })
AADD(aTable, { "NUMPAD0", 96 })
AADD(aTable, { "NUMPAD1", 97 })
AADD(aTable, { "NUMPAD2", 98 })
AADD(aTable, { "NUMPAD3", 99 })
AADD(aTable, { "NUMPAD4", 100 })
AADD(aTable, { "NUMPAD5", 101 })
AADD(aTable, { "NUMPAD6", 102 })
AADD(aTable, { "NUMPAD7", 103 })
AADD(aTable, { "NUMPAD8", 104 })
AADD(aTable, { "NUMPAD9", 105 })
AADD(aTable, { "MULTIPLY", 106 })
AADD(aTable, { "ADD", 107 })
AADD(aTable, { "SEPARATOR", 108 })
AADD(aTable, { "SUBTRACT", 109 })
AADD(aTable, { "DECIMAL", 110 })
AADD(aTable, { "DIVIDE", 111 })
AADD(aTable, { "NUMLOCK", 144 })
AADD(aTable, { "SCROLL", 145 })
nKey1 := 0
I := 1
FOR I := 1 TO LEN( aTable )
IF SUBSTR(aTable[I][1], 1, nLen ) = cGet1
nKey1 := aTable[I][2]
EXIT
ENDIF
NEXT
RETURN nKey1
Best Regards
Uwe