by juanito » Tue Jan 03, 2006 8:08 am
Ciao Ugo,
io faccio così:
****************
FUNCTION Main()
****************
.....................................
....................................
REDEFINE GET oLDL VAR cLDL ID 109 OF oFld:aDialogs[6] READONLY FONT oFont2
REDEFINE BTNBMP oBtnLDL ID 110 OF oFld:aDialogs[6] RESOURCE "search" ;
ACTION IIF(TabeSea("Legali","Ricerca Legali",2),(cLDLCod:=Legali->CodLeg,;
cLDL:=Legali->NomLeg,oLDL:Refresh()),)
oBtnLDL:cTOOLTIP:="Apre finestra Legali"
..............................
...........................
RETURN( nil )
*************************************************
FUNCTION TabeSea( cFile,cTit,nTab ) // RICERCA TABELLE
*************************************************
LOCAL oDlg, oBtnExt, oBtnNew, oBtnAll, oBtnPrn, oBtnHlp, oLbx, oBmp, oIco
LOCAL cCerca:= ""
LOCAL lSave := .f.
(cFile)->(DBSETORDER(2))
SELECT (cFile)
(cFile)->(DBGOTOP())
DEFINE FONT oFont1 NAME "MS SANS SERIF" SIZE 0, -8 BOLD
DEFINE ICON oIco RESOURCE "ricerca"
DEFINE DIALOG oDlg RESOURCE "win" TITLE cTit FONT oFont1 ICON oIco
REDEFINE BITMAP oBmp ID 101 OF oDlg RESOURCE "scritta"
REDEFINE LISTBOX oLbx FIELDS (cFile)->TabCod,(cFile)->TabDes;
ID 102 OF oDlg HEADERS "Codice", "Descrizione" ;
FIELDSIZES 80,200 COLOR "B*/W+" FONT oFont2
oLbx:aJustify := {.F.,.F.}
oLbx:nClrForeHead:= CLR_HRED
oLbx:bKeyDown := {|nKey|IIF(nKey == VK_RETURN,(lSave := .t.,oDlg:End() ) ,;
(cCerca+=UPPER(CHR(nKey)),IIF(!(cFile)->(DBSEEK(cCerca)),;
(cCerca:="",oLbx:GoTop()),))),oLbx:Refresh()}
oLbx:bLDblClick := {||cCerca:="",lSave:=.t.,oDlg:End()}
REDEFINE BUTTON oBtnExt ID 580 OF oDlg ACTION (oDlg:End())
oBtnExt:cTOOLTIP:="Esce senza selezione"
REDEFINE BUTTON oBtnNew ID 510 OF oDlg ACTION (Tabelle(nTab),;
oLbx:GoTop(),oLbx:Refresh())
oBtnNew:cTOOLTIP:="Nuovo Record"
REDEFINE BUTTON oBtnAll ID 670 OF oDlg
REDEFINE BUTTON oBtnPrn ID 590 OF oDlg
REDEFINE BUTTON oBtnHlp ID 730 OF oDlg
oBmp:lTransparent:=.t.
ACTIVATE DIALOG oDlg CENTERED ON INIT oLbx:GoTop()
(cFile)->(DBSETORDER(1))
RETURN( lSave )
Spero possa esserti di aiuto.
Giovanni Cacciotti