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

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.