Showing form problem - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Showing form problem

tijoentijoen Posts: 141Member
Hi
I built a DLL that creates a form and shows it minimized and without being activated, because I don't want the form to be focused, just created and put in the task bar

frmPVT := TfrmPVT.Create(nil);
with (frmPVT) do
begin
Name := strJogNome;
Caption := strJogNome;
ShowWindow(Handle, SW_SHOWNA);
end;

This code do what I want, but when I show the form by clicking at him in the task bar, it doesn't show the controls, it keeps empty, just the border and the background of the form are painted
I can't use frmPVT.show because it would focus the form, and I don't want it, but it is the only way I got to show the controls normally
delphi 6
any help would be very appreciated

Thanks
Jonathan

Comments

  • zibadianzibadian Posts: 6,349Member
    : Hi
    : I built a DLL that creates a form and shows it minimized and without being activated, because I don't want the form to be focused, just created and put in the task bar
    :
    : frmPVT := TfrmPVT.Create(nil);
    : with (frmPVT) do
    : begin
    : Name := strJogNome;
    : Caption := strJogNome;
    : ShowWindow(Handle, SW_SHOWNA);
    : end;
    :
    : This code do what I want, but when I show the form by clicking at him in the task bar, it doesn't show the controls, it keeps empty, just the border and the background of the form are painted
    : I can't use frmPVT.show because it would focus the form, and I don't want it, but it is the only way I got to show the controls normally
    : delphi 6
    : any help would be very appreciated
    :
    : Thanks
    : Jonathan
    :
    Try calling the SetFocus() of the form, you wish to focus, after Show()ing this form. The other form will lose focus momentarily, but it should be faster than the user can see.
  • tijoentijoen Posts: 141Member
    I thought about doing this, but wouldn't be the right... this problem just doesn't make sense :/

    : : Hi
    : : I built a DLL that creates a form and shows it minimized and without being activated, because I don't want the form to be focused, just created and put in the task bar
    : :
    : : frmPVT := TfrmPVT.Create(nil);
    : : with (frmPVT) do
    : : begin
    : : Name := strJogNome;
    : : Caption := strJogNome;
    : : ShowWindow(Handle, SW_SHOWNA);
    : : end;
    : :
    : : This code do what I want, but when I show the form by clicking at him in the task bar, it doesn't show the controls, it keeps empty, just the border and the background of the form are painted
    : : I can't use frmPVT.show because it would focus the form, and I don't want it, but it is the only way I got to show the controls normally
    : : delphi 6
    : : any help would be very appreciated
    : :
    : : Thanks
    : : Jonathan
    : :
    : Try calling the SetFocus() of the form, you wish to focus, after Show()ing this form. The other form will lose focus momentarily, but it should be faster than the user can see.
    :

  • zibadianzibadian Posts: 6,349Member
    : I thought about doing this, but wouldn't be the right... this problem just doesn't make sense :/
    :
    : : : Hi
    : : : I built a DLL that creates a form and shows it minimized and without being activated, because I don't want the form to be focused, just created and put in the task bar
    : : :
    : : : frmPVT := TfrmPVT.Create(nil);
    : : : with (frmPVT) do
    : : : begin
    : : : Name := strJogNome;
    : : : Caption := strJogNome;
    : : : ShowWindow(Handle, SW_SHOWNA);
    : : : end;
    : : :
    : : : This code do what I want, but when I show the form by clicking at him in the task bar, it doesn't show the controls, it keeps empty, just the border and the background of the form are painted
    : : : I can't use frmPVT.show because it would focus the form, and I don't want it, but it is the only way I got to show the controls normally
    : : : delphi 6
    : : : any help would be very appreciated
    : : :
    : : : Thanks
    : : : Jonathan
    : : :
    : : Try calling the SetFocus() of the form, you wish to focus, after Show()ing this form. The other form will lose focus momentarily, but it should be faster than the user can see.
    : :
    :
    :
    My guess is that ShowWindow() only shows the window frame, and not all the windowed controls with it. Show() also shows all the controls within it by calling ShowWindow() for them also.
Sign In or Register to comment.