ProgressDialog -- systemmodal or wx.STAY_ON_TOP

Hi!

Sorry for my bad English.

Is there a possibility to let a wx.ProgressDialog stay on top of all other windows on the screen? Like a wx.Dialog with the style-flag: wx.STAY_ON_TOP.

I tried wx.STAY_ON_TOP as additional style-flag, but with no effect.

Must I create my own ProgressDialog, or is there a flag, which switches on this behavior?

Regards,
Gerold
:slight_smile:

(wxPython 2.8.x on Windows XP)

路路路

--
________________________________________________________________________
Gerold Penz - bcom - Programmierung
聽聽聽聽聽http://gerold.bcom.at | http://sw3.at
Wissen hat eine wunderbare Eigenschaft:
聽聽聽聽聽Es verdoppelt sich, wenn man es teilt.

Hi Gerold,

路路路

On 6/25/07, Gerold Penz wrote:

Is there a possibility to let a wx.ProgressDialog stay on top of all
other windows on the screen? Like a wx.Dialog with the style-flag:
wx.STAY_ON_TOP.

I tried wx.STAY_ON_TOP as additional style-flag, but with no effect.

Must I create my own ProgressDialog, or is there a flag, which switches
on this behavior?

You can achieve what you ask using wx.PD_APP_MODAL in the style keyword.

HTH.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

Andrea Gavana schrieb:

Is there a possibility to let a wx.ProgressDialog stay on top of all
other windows on the screen? Like a wx.Dialog with the style-flag:
wx.STAY_ON_TOP.

You can achieve what you ask using wx.PD_APP_MODAL in the style keyword.

Hello Andrea!

Thank you for your answer. I麓ve used wx.PD_APP_MODAL. But wx.PD_APP_MODAL allows other Programs to cover the ProgressDialog. A normal wx.Dialog with the style-flag wx.STAY_ON_TOP stays over all other windows/programs. That`s what I need.

Regards,
Gerold
:slight_smile:

路路路

On 6/25/07, Gerold Penz wrote:

--
________________________________________________________________________
Gerold Penz - bcom - Programmierung
     http://gerold.bcom.at | http://sw3.at
Wissen hat eine wunderbare Eigenschaft:
     Es verdoppelt sich, wenn man es teilt.

Hi Gerold,

Andrea Gavana schrieb:
>> Is there a possibility to let a wx.ProgressDialog stay on top of all
>> other windows on the screen? Like a wx.Dialog with the style-flag:
>> wx.STAY_ON_TOP.
>
> You can achieve what you ask using wx.PD_APP_MODAL in the style keyword.

Hello Andrea!

Thank you for your answer. I麓ve used wx.PD_APP_MODAL. But
wx.PD_APP_MODAL allows other Programs to cover the ProgressDialog. A
normal wx.Dialog with the style-flag wx.STAY_ON_TOP stays over all other
windows/programs. That`s what I need.

I don't know if a pure wxPython solution to your problem exists, maybe
someone more knowledgeable than me will provide a better approach.
What I can offer is a Windows-only solution, highly untested, which
works with Mark Hammond's win32all extensions:

import wx
import win32con
import win32api

# Other code...

hwnd = yourDialog.GetHandle()
exstyle = win32api.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
theStyle = win32con.HWND_TOPMOST

win32gui.SetWindowPos(hwnd, theStyle, 0, 0, 0, 0, win32con.SWP_NOSIZE

win32con.SWP_NOMOVE)

I have no idea if this will work or not, but it's worth trying it if
you need a platform-dependent solution (Windows only).

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

路路路

On 6/25/07, Gerold Penz wrote:

> On 6/25/07, Gerold Penz wrote:

Andrea Gavana schrieb:

import wx
import win32con
import win32api

# Other code...

hwnd = yourDialog.GetHandle()
exstyle = win32api.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
theStyle = win32con.HWND_TOPMOST

win32gui.SetWindowPos(hwnd, theStyle, 0, 0, 0, 0, win32con.SWP_NOSIZE
>win32con.SWP_NOMOVE)

Hi Andrea!

That麓s a great idea! :slight_smile: I麓ll try it immediately. Thank you.

Regards,
Gerold
:slight_smile:

路路路

--
________________________________________________________________________
Gerold Penz - bcom - Programmierung
     http://gerold.bcom.at | http://sw3.at
Wissen hat eine wunderbare Eigenschaft:
     Es verdoppelt sich, wenn man es teilt.

Andrea Gavana schrieb:

hwnd = yourDialog.GetHandle()
exstyle = win32api.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
theStyle = win32con.HWND_TOPMOST

win32gui.SetWindowPos(hwnd, theStyle, 0, 0, 0, 0, win32con.SWP_NOSIZE
>win32con.SWP_NOMOVE)

Hello Andrea!

It works! I only needed those lines:

   import win32con
   import win32gui

   hwnd = progress_diag.GetHandle()
   win32gui.SetWindowPos(
       hwnd, win32con.HWND_TOPMOST, 0, 0, 0, 0,
       win32con.SWP_NOSIZE | win32con.SWP_NOMOVE
   )

Thank you!

Regards,
Gerold
:slight_smile:

路路路

--
________________________________________________________________________
Gerold Penz - bcom - Programmierung
     http://gerold.bcom.at | http://sw3.at
Wissen hat eine wunderbare Eigenschaft:
     Es verdoppelt sich, wenn man es teilt.

Andrea Gavana wrote:

Hi Gerold,

Andrea Gavana schrieb:
>> Is there a possibility to let a wx.ProgressDialog stay on top of all
>> other windows on the screen? Like a wx.Dialog with the style-flag:
>> wx.STAY_ON_TOP.
>
> You can achieve what you ask using wx.PD_APP_MODAL in the style keyword.

Hello Andrea!

Thank you for your answer. I麓ve used wx.PD_APP_MODAL. But
wx.PD_APP_MODAL allows other Programs to cover the ProgressDialog. A
normal wx.Dialog with the style-flag wx.STAY_ON_TOP stays over all other
windows/programs. That`s what I need.

I don't know if a pure wxPython solution to your problem exists, maybe
someone more knowledgeable than me will provide a better approach.

I don't think there is a wx way to do it. The progress dialog does not pass the style on to the wxDialog base class for some reason[*], and I think wx.STAY_ON_TOP is one that has no effect if you set it after creation.

[*] Please enter a bug report about this.

路路路

On 6/25/07, Gerold Penz wrote:

> On 6/25/07, Gerold Penz wrote:

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!