Ver Mensaje Individual
  #12  
Antiguo 25-02-2016
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola.

La situación no me termina de quedar clara... Cuando el valor de la columna LITERAL es NULL, ¿ Deseas que el ítem del CheckListBox incluya algún texto como sugiere la imágen de tu primer mensaje ?

Si no te interpreté mal y es así, creo que lo mas simple es hacerlo con la sugerencia de Casimiro, ejemplo :
Código PHP:
...
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  
TIBQuery *qy static_cast<TIBQuery*>(IBQuery1);

  
qy->Close();
  
qy->SQL->Clear();
  
qy->SQL->Add"SELECT DISTINCT A.SITUACION," );
  
qy->SQL->Add"COALESCE(UPPER(B.LITERAL), 'NULO') AS LITERAL" );
  
qy->SQL->Add"FROM PERSONA A LEFT JOIN INSTALACION" );
  
qy->SQL->Add"B ON A.SITUACION = B.VALOR ..." );
  ...
  for ( 
qy->Open(); !qy->Eofqy->Next() )
    
CheckListBox1->Items->Add(qy->FieldByName("LITERAL")->AsString );
  
CheckListBox1->Style lbOwnerDrawFixed;
}

void __fastcall TForm1::CheckListBox1DrawItem(TWinControl *Control,
      
int IndexTRect &RectTOwnerDrawState State)
{
  
TCheckListBox *lb static_cast<TCheckListBox*>(Control);
  
AnsiString str lb->Items->Strings[Index];

  if ( 
str == "NULO" ) {
    
lb->Canvas->Font->Color clRed;
    
lb->Canvas->Font->Style TFontStyles() << fsBold << fsUnderline;
  }
  
lb->Canvas->FillRectRect );
  
lb->Canvas->TextOutRect.leftRect.topstr );

Muestra:


Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita