Me.TopMost = True

  • Thread starter Thread starter Strahimir Antoljak
  • Start date Start date
S

Strahimir Antoljak

I'm running VS.NET 2002 and keep having problems with form keeping on top
with its TopMost property. Sometimes my program places the invoked form on
top sometimes not. Sometimes when I click on the form it stays on top as it
should, but sometimes TopMost property does not pick up so if I click to
some other program it covers the form which supposed to remain on the top.
Has anyone experienced similar problems? is there a fix? or I am
misinterpreting the property? Any input would be greatly helpful. Thanks,
 
There may be one key point you are missing.
According to the docs, Form.TopMost =
"Gets or sets a value indicating whether the form should be displayed as the
top-most form of your application."

The key part is "of your application". TopMost should make this the top form in
your application, but does not force it on top of all, or other applications.

I believe making a system wide top level form is more difficult. I haven't done
it in dotNet, but in the past it required Win32API calls to set the overall Z
order.

Gerald
 
Gerald,

thanks for your reply. That would definitely explained the part I
misunderstood. But if this is true, then now I do not understand why in
certain cases the form remains on the top of anything else (any other
application). In other words, it does set the overall Z order. (Up until
this moment I thought that TopMost property does replaces the Win32API
function for overall Z. Now, I am not sure any longer.) Just out of
curiosity, have you tried to use this property? Maybe created the most
simple app with a form and then apply that property, and see what happens
with the form - does it gain overall Z order on just app level Z order?

Thanks again for your reply,

--
Strah @ Langan

Cablewizard said:
There may be one key point you are missing.
According to the docs, Form.TopMost =
"Gets or sets a value indicating whether the form should be displayed as the
top-most form of your application."

The key part is "of your application". TopMost should make this the top form in
your application, but does not force it on top of all, or other applications.

I believe making a system wide top level form is more difficult. I haven't done
it in dotNet, but in the past it required Win32API calls to set the overall Z
order.

Gerald
 
There may be one key point you are missing.
According to the docs, Form.TopMost =
"Gets or sets a value indicating whether the form should be displayed as the
top-most form of your application."

The key part is "of your application". TopMost should make this the top form in
your application, but does not force it on top of all, or other applications.

I believe making a system wide top level form is more difficult. I haven't done
it in dotNet, but in the past it required Win32API calls to set the overall Z
order.

That may have been the case in the 1.0 version of the framework, but while
answering a question yesterday I tested TopMost under 1.1 and it most
definitely is a true topmost window as far as Windows terminology is
concerned, i.e., it stays on top of ALL windows in the system (except other
topmost windows, of course).
 
I have not had the need for a system wide top level form in dotNet yet.
For sub forms that need to be on top of the main form, I just make it owned by
the main form and this works perfectly.

However, I did just give this a try. Interestingly, it DOES seem to try to be
the top system form. So I must admit that now I am a little confused as this
seems contradictory in the docs. I suppose it is entirely possible that if
another app tries to make itself TopMost after your app is launched, then it
would proly move yours down the Z order and would no longer be Top. In my quick
test, I did not have any other apps appear on top of it. So I guess I'm stumped
as to what is going on.

Gerald


Strahimir Antoljak said:
Gerald,

thanks for your reply. That would definitely explained the part I
misunderstood. But if this is true, then now I do not understand why in
certain cases the form remains on the top of anything else (any other
application). In other words, it does set the overall Z order. (Up until
this moment I thought that TopMost property does replaces the Win32API
function for overall Z. Now, I am not sure any longer.) Just out of
curiosity, have you tried to use this property? Maybe created the most
simple app with a form and then apply that property, and see what happens
with the form - does it gain overall Z order on just app level Z order?

Thanks again for your reply,
 
Thanks Jeff,

I haven't played with that at all since 1.0, but just tried it (1.1) and ended
up quite confused, as it definately acts differently than I expected. Learned
something new today already, wahoo!

Gerald
 
thanks Jeff for the input
--
Strah @ Langan

Jeff Johnson said:
haven't

That may have been the case in the 1.0 version of the framework, but while
answering a question yesterday I tested TopMost under 1.1 and it most
definitely is a true topmost window as far as Windows terminology is
concerned, i.e., it stays on top of ALL windows in the system (except other
topmost windows, of course).
 

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

Back
Top