MARSAN Posted August 5, 2013 Report Share Posted August 5, 2013 Bom dia a tods....estou precisando usar um listbox com a cor da linha vermelha quando o estoque minimo for atingido....para os demais produtos a cor fica normal.....como faco isso? abracos @ 2, 5 LISTBOX oLbx ; FIELDS TABREF->CODREF,TABREF->DEScREF,TABREF->MARCA,TRANSF(INT(TABREF->QTDREF/VAL(SUBSTR(TABREF->APRREF,3,3))),"99999.99"),TRANSF(tabref->QTDREF - (INT(tabref->QTDREF/VAL(SUBSTR(tabref->APRREF,3,3)))*VAL(SUBSTR(tabref->APRREF,3,3))),"999999"),TRANSF(TABREF->P14D,"999999.99"),TRANSF(TABREF->PVENREF,"9999.99"),TRANSF(tabref->pcusref,"999999.99"),TRANSF(((TABREF->P14D/TABREF->PCUSREF)-1)*100,"999.99"); HEADERS "Codigo","Nome do Produto ","Embalagem","QTD","Fracao","Pr.Caixa","Pr.Unid","Pr.Custo","Margem(%)"; FIELDSIZES 50,300,130,60,60,70,70,70,70 ; SIZE 450, 215 OF oDLg FONT oFont2 COLOR "n*/w*", RGB( 255, 255, 235)oLbx:aJustify := {.F.,.F.,.F.,.f.,.f.,.f.,.f.,.f.,.f.}oLbx:bKeyDown := {|nK| ProcKeyA(nK,OLBX) } Quote Link to comment Share on other sites More sharing options...
kapiaba Posted August 5, 2013 Report Share Posted August 5, 2013 //-> Veja se ajuda: REDEFINE LISTBOX oLbx FIELDS ""; ALIAS "AUDITOR" ID 100 OF oDlg oLbx:Set3DStyle() oLbx:lHScroll := .F. oLbx:bLine := {|| { AUDITOR->USUARIO, AUDITOR->NIVEL, ; CVALTOCHAR(AUDITOR->FECHA), AUDITOR->HORA, AUDITOR->ACCION} } oLbx:aHeaders := { "Usuario","Privilegio","Fecha","Hora","Acción Realizada" } oLbx:aHJustify := {2,2,2,2,2} //-> Mudar a cor oLbx:nClrPane := {|| IIF( (oLbx:cAlias)->(OrdKeyNo())%2=0, ; nRGB(255,255,255), ColorDia(AUDITOR->FECHA) ) } oLbx:lAdjLastCol := .T. oLbx:lAdjBrowse := .T. //--------------------------------------------------------------------------// STATIC FUNCTION ColorDia(dDate) LOCAL cRGBColor:= "" LOCAL nDia:= 0 nDia:= STRZERO(DAY(dDate),2) IF nDia == "01" cRGBColor:= nRGB(255,253,196) ELSEIF nDia == "02" cRGBColor:= nRGB(208,202,183) ELSEIF nDia == "03" cRGBColor:= nRGB(222,235,255) ELSEIF nDia == "04" cRGBColor:= nRGB(206,255,196) ELSEIF nDia == "05" cRGBColor:= nRGB(255,235,206) ELSEIF nDia == "06" cRGBColor:= nRGB(194,230,253) ELSEIF nDia == "07" cRGBColor:= nRGB(255,238,255) ELSEIF nDia == "08" cRGBColor:= nRGB(173,207,247) ELSEIF nDia == "09" cRGBColor:= nRGB(228,222,203) ELSEIF nDia == "10" cRGBColor:= nRGB(180,222,185) ELSEIF nDia == "11" cRGBColor:= nRGB(217,228,255) ELSEIF nDia == "12" cRGBColor:= nRGB(202,255,239) ELSEIF nDia == "13" cRGBColor:= nRGB(255,226,204) ELSEIF nDia == "14" cRGBColor:= nRGB(246,220,255) ELSEIF nDia == "15" cRGBColor:= nRGB(226,255,216) ELSEIF nDia == "16" cRGBColor:= nRGB(250,222,237) ELSEIF nDia == "17" cRGBColor:= nRGB(251,255,224) ELSEIF nDia == "18" cRGBColor:= nRGB(234,255,211) ELSEIF nDia == "19" cRGBColor:= nRGB(255,210,211) ELSEIF nDia == "20" cRGBColor:= nRGB(255,240,255) ELSEIF nDia == "21" cRGBColor:= nRGB(217,222,180) ELSEIF nDia == "22" cRGBColor:= nRGB(254,255,231) ELSEIF nDia == "23" cRGBColor:= nRGB(231,255,204) ELSEIF nDia == "24" cRGBColor:= nRGB(211,235,184) ELSEIF nDia == "25" cRGBColor:= nRGB(255,246,224) ELSEIF nDia == "26" cRGBColor:= nRGB(255,230,231) ELSEIF nDia == "27" cRGBColor:= nRGB(239,235,222) ELSEIF nDia == "28" cRGBColor:= nRGB(255,233,176) ELSEIF nDia == "29" cRGBColor:= nRGB(231,239,222) ELSEIF nDia == "30" cRGBColor:= nRGB(255,255,213) ELSEIF nDia == "31" cRGBColor:= nRGB(248,242,223) ENDIF RETURN( cRGBColor ) // ou // :bClrStd:=ClrStd() //----------------------- STATIC FUNCTION ClrStd() //----------------------- LOCAL aCol:={} IF alias->(ordkeyno()) % 2 == 0 aCol:={CLR_BLACK, RGB(193,221,255) } ELSE aCol:={CLR_BLACK, RGB(221,245,255) } ENDIF RETURN( aCol ) Quote Link to comment Share on other sites More sharing options...
kapiaba Posted August 5, 2013 Report Share Posted August 5, 2013 // ListBox use sample with colors #Include "FiveWin.ch" //--------------------------------------------------------------------------// #Define CLR_LGRAY nRGB( 230, 230, 230 ) #Define CLR_LGREEN nRGB( 190, 215, 190 ) #Define CLR_VERMELHO nRGB( 255, 000, 000 ) //--> Vermelho Para a Letra #Define CLR_AMARELO nRgb( 255, 255, 000 ) //--> Amarelo Para o Fundo #Define CLR_BOMBOM nRGB( 165, 42, 42 ) //--> Marrom BomBom #Define CLR_MARROM nRGB( 235, 202, 171 ) //--> Marrom Normal Request OrdKeyNo Request OrdKeyCount //--------------------------------------------------------------------------// STATIC oWnd Function Main() LOCAL oLbx, oSay, wfonte_FixedSys LOCAL cItem := "Troque a Cor da ListBox em Tempo Real" LOCAL oBtn1, oBtn2 LOCAL cTitle := ( "Testando uma ListBox com Cores - " ) + ; ( "kapiaba@brfree.com.br" ) ; DEFINE FONT wfonte_FixedSys NAME "FixedSys" SIZE 10,10 DEFINE WINDOW oWnd FROM 1, 1 TO 20, 60 ; TITLE OemToAnsi( cTitle ) ; COLOR "W+/B" @ 2, 2 LISTBOX oLbx VAR cItem ; ITEMS { "Item One", "Item Two", "Item Three", ; "Item Four", "Item Five" } ; OF oWnd SIZE 200, 150 ; COLOR CLR_BROWN, CLR_LGREEN ; FONT WFONTE_FIXEDSYS @ 2, 40 SAY oSay VAR cItem SIZE 200, 12 OF oWnd @ 8, 42 BUTTON oBtn1 PROMPT "&Cores" SIZE 80, 23 ; ACTION( SET_COLOR( oLbx ) ) oBtn1:cToolTip := OemToAnsi( "N¢is ‚ bom com cores " ) @ 11, 42 BUTTON oBtn2 PROMPT "&Fim " SIZE 80, 20 OF oWnd ; ACTION ( oWnd:End() ) CANCEL ; MESSAGE "Pressione-me Para Finalizar" oBtn2:cToolTip := OemToAnsi( "Saida - Exit - Cancelar " ) SET MESSAGE OF oWnd TO "Testando Cores na ListBox" SET FONT OF oBtn1 TO WFONTE_FIXEDSYS SET FONT OF oBtn2 TO WFONTE_FIXEDSYS ACTIVATE WINDOW oWnd wfonte_FixedSys:End() Release All Return Nil //---------------------TROCA A COR EM TEMPO REAL----------------------------// Function SET_COLOR( oLbx ) LOCAL oBrush //-> Troca a cor da tela /* DEFINE BRUSH oBrush COLOR ChooseColor() SET BRUSH OF oWnd TO oBrush */ //-> Troca a Cor da ListBox em tempo real oLbx:SetColor( oLbx:nClrText, ChooseColor( oLbx:nClrPane ) ) oLbx:Refresh() oLbx:SetFocus() Return Nil //--------------------------------------------------------------------------// Ou oLbx:nClrPane := { || IIF( ( oLbx:cAlias)->( OrdKeyNo()) %2 == 1, ; {CLR_WHITE, if( DATA > date(), CLR_RED, RGB(204,255,255))}, {CLR_WHITE, if( DATA > date(), CLR_RED, RGB(127,192,144))} )} //-> FIM DO PROGRAMA Quote Link to comment Share on other sites More sharing options...
Yury Posted August 5, 2013 Report Share Posted August 5, 2013 Olá oLbx:nClrText := {|| IF(PR->PRESTQ < PR->PRESTQMIN, CLR_HRED,CLR_BLACK) } // cor da linha oLbx:nClrPane := {|| IF(PR->PRESTQ < PR->PRESTQMIN, CLR_LRED,CLR_WHITE) } // cor do fundo Abraço Quote Link to comment Share on other sites More sharing options...
cendon Posted August 5, 2013 Report Share Posted August 5, 2013 Obrigado pelas dicas a todos, o post não é meu mas já resolveu um problema. Quote Link to comment Share on other sites More sharing options...
MARSAN Posted August 7, 2013 Author Report Share Posted August 7, 2013 Obrigado pela atencao de todos........resolveu meu problema. abracos Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.