by angstin » Thu Oct 30, 2008 2:34 am
Saludos mcfox... te anexo el codigo...
//este es el browse que utilizo:
TWBrowse():lHScroll:= .F.
@ 6, 2 LISTBOX Brw1 ;
FIELDS "" ;
ALIAS (CALIAS) ;
OF oWndChild ;
UPDATE
Brw1:SetCols( bro_campo, bro_subtit)
Brw1:bDropOver = { | uDropInfo, nRow, nCol, nKeyFlags | ;
Brw1:Add( uDropInfo ), MsgBeep() }
Brw1:lCellStyle = .T.
Brw1:lAutoEdit = .T.
Brw1:lAutoSkip = .T.
Brw1:ladjlastcol:=.F.
Brw1:lDrawFocusRect:=.F.
Brw1:nLineStyle:= 2
Brw1:Set3DStyle()
Brw1:nHeaderHeight := 18
Brw1:nLineHeight := 15
Brw1:bLogicLen = { || ( Brw1:CALIAS ) -> ( adskeycount() ) } // ( ORDKeyCount() )
Brw1:nClrPane := {|| IIF((Brw1:CALIAS)->(adskeyno()) % 2 == 0 ,RGB(193,221,255),RGB(221,245,255) )}
Brw1:SetSize( oWnd:nWidth-80, oWnd:nHeight-200, .t. )
Brw1:bBkColor:= {|nRow,nCol,nStyle| ;
if( nStyle==3 .OR. nStyle=0, if( nCol==1,GetSysColor( COLOR_BTNFACE ),),) }
Brw1:bTextColor:= {|nRow,nCol,nStyle| ;
if( nStyle==3 .OR. nStyle=0, if( nCol==1,RGB( 192,192,192 ),),) }
Brw1:bKeyChar := {|nK| if( nK==VK_RETURN,Brw1:Edit(Brw1:nColAct,.t.),) }
Brw1:bEdit:= {|nCol, cBuffer, lFirstEdit|;
EDICION( Brw1, nCol, cBuffer, CALIAS, lFirstEdit, xCols, oWnd ) }
//la funcion de edicion:
STATIC Function EDICION( Brw1, nCol, cBuffer, CALIAS, lFirstEdit, xCols, oWnd )
LOCAL aResult, uBuffer, lContinue:= .T.
LOCAL bValid, aItems, bAction, nClrFore, nClrBack
nClrFore := RGB(0,0,0)
nClrBack := RGB(149,198,147)
FOR nCol := 1 TO xCols
Do Case
Case nCol == 2 // ID COM
uBuffer := (CALIAS)->id_com
bValid := {|| IF(EMPTY(aResult:=SELECEMPRE(@uBuffer)),.F.,.T.)}
IF lContinue:= Brw1:lEditCol( nCol, @uBuffer, "@!", bValid, nClrFore, nClrBack)
IF !EMPTY(uBuffer)
IF(WndSetFocus("Compañias",oWnd))
REPLACE (Brw1:CALIAS)->id_com WITH uBuffer
ENDIF
ENDIF
ENDIF
ENDDO
NEXT nCol
//la funcion SELECEMPRE() me llama a otra funcion es la que me arma
//la ventana MDI de empresas:
FUNCTION SELECEMPRE( xVar )
LOCAL aRetorno
aRetorno := COMP0101( @xVar )
RETURN aRetorno
// esta funcion la uso para darle el focus al windows por el ctitle
FUNCTION WndSetFocus(cTitle,oWnd)
*------------------------------------------------------*
local i:=0,lSuccess:=.f.
cTitle:=upper(cTitle)
FOR i=1 to len(oWnd:oWndClient:aWnd)
IF upper( oWnd:oWndClient:aWnd[i]:cCaption )=cTitle
oWnd:oWndClient:aWnd[i]:SetFocus()
lSuccess:=.t.
ENDIF
NEXT
RETURN lSuccess
Angel Stincone... Saludos...
FWH 8.08
XHARBOUR 1.1.0
VERCE 5.3
ADS 9.0