Ya que tienes un frame, yo haría esto en tu frame:
Espero no te confunda los nombres que he usado, como ves, he puesto los mismos nombres que tú, pero anteponiendo el prefijo "sb" de
Show
Buttons
Código Delphi
[-]
type TShowButtons = set of (sbNewPatient, sbEditPatient, sbDeletePatient,
sbNewStudy, sbEditStudy, sbDeleteStudy, sbCamera, sbPrint, sbBack);
type TfrToolbar = class(TFrame)
private
FShowButtons :TShowButtons;
procedure SetShowButtons(Value:TShowButtons);
public
property ShowButtons : TShowButtons read FShowButtons write SetShowButtons;
end
Implementation
procedure TfrToolbar.SetShowbuttons(Value:TShowButtons);
begin
FShowButtons := Value;
boNewPatient.Visible:= sbNewPatient in Value;
boDeletePatient.Visible:= sbDeletePatient in Value;
boNewStudy.Visible:= sbNewStudy in Value;
boEditStudy.Visible := sbEditStudy in Value;
boDeleteStudy.Visible:= sbDeleteStudy in Value;
boCamera.Visible:= sbCamera in Value;
boPrint.Visible:= sbPrint in Value;
boBack.Visible:= sbBack in Value;
end;
Ahora ya no tienes que ocultar los botones antes de cambiar ventana.
Cuando cambies de ventana, si en esa ventana debes mostrar los botones NewPatient, DeletePatient, Print y Back, harías esto:
Código Delphi
[-]
with frmMain.frtoolbar do
ShowButtons := [sbNewPatient, sbDeletePatient, sbPrint, sbBack];
Al asignar la propiedad ShowButtons, dentro del frame se ejecutará el procedimiento SetShowButtons que pondrá visible los botones que hayas especificado. El resto de botones los pondrá invisibles.
Saludos