Ver Mensaje Individual
  #28  
Antiguo 25-02-2016
jhonalone jhonalone is online now
Miembro
 
Registrado: sep 2007
Ubicación: Madrid
Posts: 547
Reputación: 17
jhonalone Va por buen camino
Bueno, el mensaje anterior no sirve de nada. Estaba editando... y se me pasó el tiempo de 30 m.
Es una faena, porque lo tenía casi terminado y ahora tengo que empezar de nuevo.

POR SI LE INTERESA A ALGUIEN.

Vídeo del problema, (Que parece que me explico mal).
http://="https://www.youtube.com/wat...?v=-711A257_0g



Vídeo del problema resuelto.



Código que funciona mal
Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
begin
  Col9.Width := grdTablero.Width / 9;
  Col1.Width := grdTablero.Width / 9;
  Col2.Width := grdTablero.Width / 9;
  Col3.Width := grdTablero.Width / 9;
  Col4.Width := grdTablero.Width / 9;
  Col5.Width := grdTablero.Width / 9;
  Col6.Width := grdTablero.Width / 9;
  Col7.Width := grdTablero.Width / 9;
  Col8.Width := grdTablero.Width / 9;
   grdTablero.RowHeight:= grdTablero.Height / 9;
end;

Código que funciona bien
Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
begin
  Col9.Width := grdTablero.Width / 9;
  Col1.Width := grdTablero.Width / 9;
  Col2.Width := grdTablero.Width / 9;
  Col3.Width := grdTablero.Width / 9;
  Col4.Width := grdTablero.Width / 9;
  Col5.Width := grdTablero.Width / 9;
  Col6.Width := grdTablero.Width / 9;
  Col7.Width := grdTablero.Width / 9;
  Col8.Width := grdTablero.Width / 9;
   grdTablero.RowHeight:= (grdTablero.Height - 2) / 9;
   { A grdTablero.Height hay que RESTARLE algún punto, si no la última fila
     de abajo no queda seleccionada cuando se pulsa en ella siook la celda que
     estaba seleccionada antes no ccrrespondía a la última fila }
end;

La causa del problema. (Espero que se me entienda en castellano)

Dado que la rejilla (TStringGrid) llamada "grdTablero" ocupa todo el espacio de su propiedad grdTablero.RowHeight con sus 9 filas, parece que la última fila no se activa correctamente y causa el error.



La SOLUCIÓN DEL PROBLEMA.

Cuando dejamos un espacio después de la última fila, (aunque sea sólo de 2 píxeles), la última fila queda activada para recibir el foco cuando es seleccionada.

Saludos a todos.

Última edición por jhonalone fecha: 25-02-2016 a las 17:56:24.
Responder Con Cita