LISTBOX

HMG en Español

Moderator: Rathinagiri

Post Reply
AidTIC
Posts: 72
Joined: Mon Apr 22, 2013 8:29 am
Been thanked: 2 times

LISTBOX

Post by AidTIC » Thu Apr 12, 2018 11:54 am

Hola,

Se puede en un LISTBOX , poner el fondo de cada fila de un color?
Gracias
* * * * translated * * * *
Hello,

You can in a LISTBOX, put the bottom of each row of a color?

Thank you

Code: Select all

DEFINE WINDOW vCarro   ;
	              AT 0,0	              ;
	              WIDTH 300	              ;  
	              HEIGHT 500	   ;
	              TITLE "Seleciona Carro" ;
				  ICON ""	    ;
	               	TOPMOST 	    ;			          			           
	              NOSIZE		; 
                  FONT "Bookman Old Style" SIZE 18 ;				  
                  BACKCOLOR WHITE 
				 
		DEFINE LISTBOX lcarro
			ROW	10
			COL	10
			WIDTH	250
			HEIGHT	450
			ITEMS	sCarros 
			DYNAMICBACKCOLOR { || if ( MOD( vCarro.lcarro.Value  , 2 ) = 0  , { 0 , 0 , 255 } , { 255 , 0 , 0 } )      }
			ONDBLCLICK (carro :=  iCELLNAVIGATION .T.
		END LISTBOX		 

		 
    END WINDOW

User avatar
SALINETAS24
Posts: 172
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Has thanked: 2 times
Been thanked: 3 times

Post by SALINETAS24 » Sun Apr 15, 2018 8:59 pm

Hola, en un listbox no lo se pero un GRID si.
Te paso el trozo de código que desarrollo el compañero MUSTAFA lo hace genial.
Imagino que copiando la parte que te interesa lo tendrás.

Code: Select all

      fColor := { || if ( This.CellRowIndex/2 == int(This.CellRowIndex/2) , BLUE , RED ) }
      bcolor := { || if ( This.CellRowIndex/2 = int (This.CellRowIndex/2) , {180,200,255} , {255,255,211} ) }   
         
*-----------------------------------------------------------------------------------------------------------*
*----------------------------------------------- Color Barra Video Inversa ---------------------------------*
  _HMG_SYSDATA [ 348 ] := { 199,250,225 }    
  _HMG_SYSDATA [ 349 ] := { 007,071,041 }   
  _HMG_SYSDATA [ 350 ] := { 235,237,095 }   
  _HMG_SYSDATA [ 351 ] := { 069,015,135 }  
*-----------------------------------------------------------------------------------------------------------*

        SELECT 1
        USE STOCK INDEX STOCK
      
   DEFINE GRID Grid_1
      ROW     070  
      COL     030
      WIDTH   700
      HEIGHT  379  
      HEADERS { '','Ref','Producto','Tipo','Precio','C_Barras' }  
      WIDTHS  { 17, 122 , 149 , 135 , 116 , 138 }
      VALUE 0  
      IMAGE   { 'Resource\02x.bmp','Resource\01x.bmp' }   
      JUSTIFY { GRID_JTFY_LEFT, GRID_JTFY_RIGHT, GRID_JTFY_LEFT , GRID_JTFY_LEFT, GRID_JTFY_RIGHT, GRID_JTFY_LEFT} 
      DYNAMICFORECOLOR { fColor , fColor, fColor , fColor, fColor, fColor } 
      DYNAMICBACKCOLOR { bColor , bColor, bColor , bColor, bColor, bColor }  
      BACKCOLOR { 209,238,238 }
      FONTCOLOR { 000,255,020 } 
      ONCHANGE ( SelecDes() , PositionData()  ) 
      MULTISELECT .F.
      SHOWHEADERS .T. 
      ROWSOURCE "STOCK"
      COLUMNFIELDS { 'IIF(STOCK->L,1,0)','STOCK->REF','STOCK->PRODUCTO','STOCK->TIPO','TRAN(STOCK->PRECIO, "@E 9,999,999.99")','STOCK->CBARRAS' }  
      FONTNAME 'Arial'                                                             // <----to show a dot instead a comma ---> //
      FONTSIZE 9
      CELLNAVIGATION .T.
    END GRID

AidTIC
Posts: 72
Joined: Mon Apr 22, 2013 8:29 am
Been thanked: 2 times

Post by AidTIC » Tue Aug 21, 2018 4:10 pm

Gracias

Post Reply