Hide component in first record (DBCtrlGrid)

1

In TDBCtrlGrid I want to hide a component, actually a TPanel only in the first record of dataset . I tried the DBCtrlGrid1PaintPanel event by checking when the Index = 0 but when for example the first record is selected it ends up showing the control, because the component continues redrawing the records below Changes the TPanel to Visible. Can you do that? Hide or show a control depending on the registry index?

    
asked by anonymous 28.03.2018 / 14:15

2 answers

0

Dude I did a test here and managed to hide a component as follows

procedure TFo_Cadastro_Generico.DBGrid1KeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
   Me_Busca.Visible:=  Qy_Principal.RecNo <> 1;
end;

In the dagrid event keyup I check if the current registry number is different from 1 (first) if it is to leave the maskedit search visible, if it is the first one leaves the maskedit search invisible.

I hope to have understood your question correctly :). And I hope it was clear in my example too:)

Any doubt is just to talk.

    
30.03.2018 / 17:22
0

You can use the AfterScroll event of the DataSet to make the Panel Visible or not, it would look something like this:

procedure TfrmPrincipal.ClientDataSet1AfterScroll(DataSet: TDataSet);
begin
  Panel1.Visible:= ClientDataSet1.RecNo >1;
end;

So this way every time the first record is selected in the DBControlGrid the Panel will not be visible.

    
12.04.2018 / 20:55