Keep a form on top of the app only

S

Shane

How do you keep a form on top of an application only.

I know that I can use "TopMost" to keep a form on top of the other
forms, but that solution is Windows scope instead of only my
application scope.

I have a floating "Totals" screen (among others) so that a user can
see which checks will print, total receipts, and other items. They can
resize the form, and move it anywhere on the screen, so creating a
dock area on the screen is not an option.

If my program loses focus, the "Totals" form stays on the screen.
Obviously, that's a bit of a problem when the user goes into Outlook
or something.

If there is no command to make a "Topmost" only applicable to a single
program instead of system wide, is there a way to tell when my
application loses focus? I could check an event and hide any floating
forms.

Thanks.
 
P

pamela fluente

How do you keep a form on top of an application only.

I know that I can use "TopMost" to keep a form on top of the other
forms, but that solution is Windows scope instead of only my
application scope.

I have a floating "Totals" screen (among others) so that a user can
see which checks will print, total receipts, and other items. They can
resize the form, and move it anywhere on the screen, so creating a
dock area on the screen is not an option.

If my program loses focus, the "Totals" form stays on the screen.
Obviously, that's a bit of a problem when the user goes into Outlook
or something.

If there is no command to make a "Topmost" only applicable to a single
program instead of system wide, is there a way to tell when my
application loses focus? I could check an event and hide any floating
forms.

Thanks.

have you tried if you can solve with the "owner" property?

TotalsScreen.Owner = FormUnderneath

-P
 
S

Shane

I don't really understand your reply Pamela.

If I show the form on the parent, which I do, and the Totals form is
not set to Topmost, the Totals form will be hidden under the parent
form as soon as a control (textbox) gets focus on the parent control.

Shane
 
P

pamela fluente

I don't really understand your reply Pamela.

If I show the form on the parent, which I do, and the Totals form is
not set to Topmost, the Totals form will be hidden under the parent

I do not not exactly your situation. I usually use
owner / show (not showdialog) to keep a form always on top of another
and
be free to move it.
Another solution would be to define it as a form contained in a
control
by setting YourFloatingForm.TopLevel = False.

So I am guessing it can work for you too.

The owned form cannot go under the owner (a owner is a "special"
parent) form.

-P
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top