Fórum Reposicionar botoes num form herdado #324903
06/07/2006
0
tenho um form Pai que nele já está as configurações padrões. No mesmo existe botoes de salvar e fechar, sendo que eu queria que quando o form filho fosse carregado esses botões fossem posicionados sempre no mesmo local. Entao no Pai, no evento show tenho que fazer isso, só não consigo referenciar-me ao form atualmente ativo, que seria o filho:
procedure TfPai1.FormShow(Sender: TObject); begin Start(self); PainelLinha.Left := TForm(Self.Owner).Left ; PainelLinha.Width := TForm(Self.Owner).Width ; PainelLinha.Top := TForm(Self.Owner).Height - 63; BotaoFechar.Top := TForm(Self.Owner).Height - 56; BotaoFechar.Left := TForm(Self.Owner).Width - 162; BotaoSalvar.Top := TForm(Self.Owner).Height - 56; BotaoSalvar.Left := TForm(Self.Owner).Width - 86; end;
Até
Aldus
Curtir tópico
+ 0Posts
07/07/2006
Aldus
Gostei + 0
07/07/2006
Aldus
Self.
Só não consigo pegar os tamanhos dos componentes deste form, pois no comando Self.Components[1] não existe a propriedade Top e Height.
Eu quero ajustar automaticamente o ClientHeight do form com base nos tamanhos dos componentes contidos no form (Self), só preciso saber esses valores.
O evento Show do FormPai ficaria assim:
MaxH:=0; for i:=0 to Self.ComponentCount-1 do begin if ((Self.Components[I] is TEdit) or (Self.Components[I] is TCurrencyEdit) or (Self.Components[I] is TGroupBox)) then begin if MaxH < (Self.Components[I].Top+Self.Components[I].Height) then MaxH := (Self.Components[I].Top+Self.Components[I].Height); end end; Self.ClientHeight := MaxH + 40; if Self.PainelLinha.Visible then begin PainelLinha.Left := 0 ; PainelLinha.Width := Self.Width ; PainelLinha.Top := Self.Height - 63; end; BotaoSalvar.Top := Self.Height - 56; BotaoSalvar.Left := Self.Width - 162; BotaoFechar.Top := Self.Height - 56; BotaoFechar.Left := Self.Width - 86; Self.Refresh
Alguma sugestão?
Gostei + 0
07/07/2006
Aldus
Gostei + 0
07/07/2006
Micheus
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)