Bbrowser Metodos



 

CLASS bBrowser3 INHERIT bBrowser

// Caracteristicas por default al iniciar el bbrowser
METHOD init(oOwner, uID, oOrigin, oDimension, kStyle) CLASS bBrowser3
 SUPER:init(oOwner, uID, oOrigin, oDimension, kStyle)

// Activar la tecla Ctrl+C para copiar la celda actual al portapapeles.
SELF:KeyCommand:Add(bKeyCommand{0x43,, TRUE,,, SELF, #CellCopy})

RETURN SELF


//Copiar el contenido de una celda
//Ejemplo: self:MyBbrowser:CellCopy() 
METHOD CellCopy() CLASS bbrowser3
LOCAL oCell      AS bCell
LOCAL oColumn    AS bDataColumn 
LOCAL oClip      AS clipboard  

IF SELF:CurrentColumn > 0
 oClip:= Clipboard{}
 
 oCell := bCell{self:CurrentColumn, self:CurrentRow,self:CurrentRecNo}
 oColumn := self:GetOpenColumn(oCell:Column)

 oClip:Clear() 
 oClip:Insert(oColumn:TextValue) 
ENDIF

RETURN SELF


// Colorear texto y/o fondo, en una o varias columnas.
//Ejemplos:
// self:MyBbrowser:ColumnColor({1,3}) 
// self:MyBbrowser:ColumnColor({1,3},Color{COLORRED})
// self:MyBbrowser:ColumnColor({1,3},Color{COLORRED},Brush{Color{COLORWHITE}})
// self:MyBbrowser:ColumnColor({#campo1,#campo3})

METHOD ColumnColor(auFieldID, oForeground, oBackground) CLASS bBrowser3
 LOCAL oColumn    AS  bDataColumn  
 LOCAL iPos       AS INT 
 LOCAL iSize      AS INT
 
 Default(@oForeground, Color{COLORBLUE})
 Default(@oBackground, null_object)  

 IF SELF:oServer<>null_object ;
   .and. !Empty(auFieldID) .and. IsArray(auFieldID)  .and. SELF:iColumnCount>0 

  iSize := INT(_cast, ALen(auFieldID))

  FOR iPos:=1 UPTO iSize  
   
    IF IsInstanceOfUsual(auFieldID[iPos], #bNameArray)
     oColumn := SELF:GetColumn(auFieldID[iPos]:Get(#Field))
    ELSEIF !IsArray(auFieldID[iPos])    
     oColumn := SELF:GetColumn(auFieldID[iPos])
    ELSEIF ALen(auFieldID[iPos])>=2     
     oColumn := SELF:GetColumn(auFieldID[iPos, 1])
    ELSE
     oColumn := null_object
    ENDIF
    IF oColumn<>null_object   
     oColumn:DataView := bViewStyle{oForeground, oBackground ,,,,,BABR_AUTO}
    ENDIF  

  NEXT

  SELF:Redraw() 
 ENDIF

 RETURN SELF
 
// Pinta las lineas de dos colores alternadamente.
// Ejemplo:
//   self:oDCbBrowser1:Bicolor(Brush{Color{COLORBLUE}})
//   self:oDCbBrowser1:Bicolor(Brush{Color{COLORBLUE}},Brush{Color{COLORRED}})
METHOD Bicolor(oBackground1, oBackground2) CLASS bBrowser3 
 Default(@oBackground1, Brush{Color{COLORGREEN}})    
 Default(@oBackground2, null_object) 
 self:Grid:BackgroundList:Add(oBackground1)
 self:Grid:BackgroundList:Add(oBackground2)
 self:Redraw() 
RETURN self



Comentarios

Entradas populares