by Otto » Wed Oct 10, 2007 10:12 pm
Hello Tim,
ad 4)
to get this functionality I use the following code.
Regards,
Otto
@ 3, 1 LISTBOX oLbx FIELDs STR(umsatz->renr) ...
@ 0.3,38 GET oSay VAR cFind OF oBar SIZE 160,26 UPDATE READONLY
oLbx:bkeyChar :={|nKey|iif(nKey == K_ENTER, ;
prn_RgKOPIE(nhorzM,nVertM), ;
cFind := KeySeek(nKey,oLbx_PR,oSay,@cFind) ) , ;
oLbx:SetFocus(),oLbx:Refresh() }
oLbx:bChange := {|| cFind := "" , oSay:Refresh() }
oLbx:aActions = Array( ( Alias())->(FCount() ) )
FOR n := 1 TO Len( oLbx:aActions)
IF n = 1
oLbx:aActions [n] ={|| cFind := "",oSay:Refresh() ,index_mrez(n:=1,oLbx)}
elseif n = 6
oLbx:aActions [n] ={|| cFind := "" , oSay:Refresh() ,index_mrez(n:=2,oLbx)}
elseif n = 2
oLbx:aActions [n] ={|| cFind := "" , oSay:Refresh() ,index_mrez(n:=3,oLbx)}
else
oLbx:aActions [n] ={|| cFind := "",oSay:Refresh(), tone(300,4)}
ENDIF
NEXT
+++++++++++++++++++++++++++++++++++++++++++++
func index_mrez(n,oLbX)
*--------------------------------------------
select lager
if n = 1
oLbx:aHeaders:={ "-> Bezeichnung", "|| Kategorie","Kartenpreis","Wareneinsatz","Nettorohaufschlag","|| Artikel-NR" }
set order to 5
elseif n = 2
oLbx:aHeaders:={ "|| Bezeichnung", "|| Kategorie","Kartenpreis","Wareneinsatz","Nettorohaufschlag","-> Artikel-NR" }
set order to 1
elseif n = 3
oLbx:aHeaders:={ "|| Bezeichnung", "-> Kategorie","Kartenpreis","Wareneinsatz","Nettorohaufschlag","|| Artikel-NR" }
set order to 3
endif
oLbx:refresh()
oLbx:SetFocus()
RETURN NIL
func KeySeek(nKey, oBrw, oSay, cSeek)
LOCAL cKey := upper( chr(nKey) )
LOCAL nRecno := recno()
LOCAL test := cSeek
* MSGINFO(str(nkey))
do case
CASE nKey == K_UP ; oBrw:up() ; cSeek := ""
CASE nKey == K_DOWN ; oBrw:down() ; cSeek := ""
* CASE nkey == K_LEFT ; oBrw:left() ; cSeek := ""
* CASE nkey == K_RIGHT ; oBrw:right() ; cSeek := ""
CASE nKey == K_PGUP ; oBrw:pageup() ; cSeek := ""
CASE nKey == K_PGDN ; oBrw:pagedown() ; cSeek := ""
CASE nKey == K_CTRL_PGUP ; oBrw:GoTop() ; cSeek := ""
CASE nKey == K_CTRL_PGDN ; oBrw:GoBottom() ; cSeek := ""
CASE nKey == K_HOME ; oBrw:GoTop() ; cSeek := ""
CASE nKey == K_END ; oBrw:GoBottom() ; cSeek := ""
OTHERWISE
IF nKey == K_BS
cSeek := Left(cSeek, Len(cSeek) - 1 )
else
cSeek := cSeek + cKey
ENDIF
if len(Alltrim(indexkey())) > 0
if "UPPER"$upper(ordkey())
cSeek=UPPER( (cSeek))
else
cSeek= (cSeek)
endif
dbseek(cSeek , .T. )
cSeek= (cSeek)
else
MsgInfo("Kein Index ausgewählt")
endif
IF Found()
oBrw:Refresh()
test := cSeek
oBrw:Upstable()
cSeek := test
else
cSeek := Left(cSeek, Len(cSeek) - 1 )
DbGoTo(nRecno)
ENDIF
endcase
oSay:Refresh() // ; oSay:SetText( cSeek )
RETURN( cSeek )