Howdy, Stranger!

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

Categories

delphi forms

dzanossidzanossi Member Posts: 6
[b][red]This message was edited by dzanossi at 2005-5-26 13:10:52[/red][/b][hr]
I have to very important questions. I am very very short on time so I will appreciate every hint. The first one is how to show a second form without losing activity on the main one ??

The second problem is probably more complex - I have a main form with a timer and a second form which is being hidden and shown by this timer. When I minimize the first form and switch to another application, the timer is still working but the second form vanishes and can't be shown. How to avoid this, so even if my application is hidden in tray the second form still shows ??

Thank you in advance.
Phillip


Comments

  • zibadianzibadian Member Posts: 6,349
    : [b][red]This message was edited by dzanossi at 2005-5-26 13:10:52[/red][/b][hr]
    : I have to very important questions. I am very very short on time so I will appreciate every hint. The first one is how to show a second form without losing activity on the main one ??
    :
    : The second problem is probably more complex - I have a main form with a timer and a second form which is being hidden and shown by this timer. When I minimize the first form and switch to another application, the timer is still working but the second form vanishes and can't be shown. How to avoid this, so even if my application is hidden in tray the second form still shows ??
    :
    : Thank you in advance.
    : Phillip
    :
    :
    :
    1: User the Show() method instead of the ShowModal().

    2: Remove the Form from the auto-create. Then in the mainform's OnCreate() create that form using a line like this:
    [code]
    Form2 := TForm2.Create(nil);
    [/code]
    Now the form doesn't have an Owner and can be shown independently. The disadvantage is that the form has its own taskbar button and must be freed manually.
    It might be better to create and show the form in the OnTimer() and free it again, if it needs to be hidden.
  • dzanossidzanossi Member Posts: 6
    : : [b][red]This message was edited by dzanossi at 2005-5-26 13:10:52[/red][/b][hr]
    : : I have to very important questions. I am very very short on time so I will appreciate every hint. The first one is how to show a second form without losing activity on the main one ??
    : :
    : : The second problem is probably more complex - I have a main form with a timer and a second form which is being hidden and shown by this timer. When I minimize the first form and switch to another application, the timer is still working but the second form vanishes and can't be shown. How to avoid this, so even if my application is hidden in tray the second form still shows ??
    : :
    : : Thank you in advance.
    : : Phillip
    : :
    : :
    : :
    : 1: User the Show() method instead of the ShowModal().
    :
    : 2: Remove the Form from the auto-create. Then in the mainform's OnCreate() create that form using a line like this:
    : [code]
    : Form2 := TForm2.Create(nil);
    : [/code]
    : Now the form doesn't have an Owner and can be shown independently. The disadvantage is that the form has its own taskbar button and must be freed manually.
    : It might be better to create and show the form in the OnTimer() and free it again, if it needs to be hidden.
    :

    Thanks i've already figured something like this:

    SetWindowPos(TextForm.Handle, hwnd_Topmost, 0, 0, 0, 0, swp_NoMove or swp_NoSize or swp_ShowWindow or swp_NoActivate);

    it causes the window to show without activating it, and what's more it makes always stay-on-top what I also needed.

    however thank you, for your hint, I'm sure it would work - I thought about something similar but done by overriding method which changes TCreateParams
Sign In or Register to comment.