Ver Mensaje Individual
  #3  
Antiguo 10-11-2014
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.197
Reputación: 20
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
El siguiente ejemplo funciona en tiempor real, mientras su pulsa en los items:

Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
begin
  Label7.Caption:= '';
  Label8.Caption:= '';
end;


procedure TForm1.chNameClickCheck(Sender: TObject);
var
  i, j: integer;
begin
  j:=  0;
  for i:= 0 to chName.Items.Count -1 do if chName.Checked[i] then inc(j);

  if j > 2 then
  begin
    Application.MessageBox ('Sólo pueden seleccionarse dos colores','Atención',mb_iconInformation + mb_Ok);
    chName.Checked[chName.ItemIndex]:= false;
  end;

  if chName.Checked[chName.ItemIndex] then
  begin
    if label7.Caption = '' then
      label7.Caption:= QuotedStr(chName.Items[chName.ItemIndex])
    else if label8.Caption = '' then
      label8.Caption:= QuotedStr(chName.Items[chName.ItemIndex]);
  end
  else
  begin
    if label7.Caption = QuotedStr(chName.Items[chName.ItemIndex]) then label7.Caption:= '';
    if label8.Caption = QuotedStr(chName.Items[chName.ItemIndex]) then label8.Caption:= '';
  end;
end;


Saludos.
Responder Con Cita