Page 1 of 1

Posted: Thu Jun 13, 2002 11:07 am
by BackupUser
Restored from previous forum. Originally posted by teachco.

Parameter 'modal' in openWindow? Is this possible und useful?

Not so important, but nice to have. There exist a solution with Win API.


Edited by - teachco on 26 June 2002 14:22:41

Posted: Fri Jun 14, 2002 2:13 am
by BackupUser
Restored from previous forum. Originally posted by PB.

> Parameter 'modal' in openWindow? Is this possible und useful?

To do what? Stop all other apps from getting the focus? I don't think it's
possible in a multitasking environment like Windows. But if you want to keep
your app's window on top of all others, just do this after creating it:

Code: Select all

SetWindowPos_(WindowID(),#HWND_TOPMOST,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE) ; On top.
And, to stop this behaviour again:

Code: Select all

SetWindowPos_(WindowID(),#HWND_NOTOPMOST,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE) ; Not on top.

PB - Registered PureBasic Coder

Posted: Fri Jun 14, 2002 4:39 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.

>To do what? Stop all other apps from getting the focus?

Not other applications, but other Windows in the same
Application.

When you open 3 Windows, the user can switch between this
3 Windows like he wants.
Now you open Window 4 as "modal", and the user cant use
the other 3 Windows anymore until the modal Window is
closed.

I think this worked with the "PopUpWindow" addon Library,
but i´m not sure about this.

cya,
...Danilo

(registered PureBasic user)

Posted: Fri Jun 14, 2002 7:50 am
by BackupUser
Restored from previous forum. Originally posted by PB.
When you open 3 Windows, the user can switch between this
3 Windows like he wants.
Now you open Window 4 as "modal", and the user cant use
the other 3 Windows anymore until the modal Window is
closed.
Ah, I see. I'd just use EnableWindow_(WindowID(),#FALSE) to disable the
calling window... it's how vis2pure does it in v0.30 when calling another
window.

PB - Registered PureBasic Coder

Posted: Mon Jun 17, 2002 9:57 am
by BackupUser
Restored from previous forum. Originally posted by teachco.
When you open 3 Windows, the user can switch between this
3 Windows like he wants.
Now you open Window 4 as "modal", and the user cant use
the other 3 Windows anymore until the modal Window is
closed.
Ah, I see. I'd just use EnableWindow_(WindowID(),#FALSE) to disable the
calling window... it's how vis2pure does it in v0.30 when calling another
window.

PB - Registered PureBasic Coder
EnableWindow_(WindowID(),#FALSE) is working fine
Thank you for the tip.

You find the complete solution under BEGINNERS "MODAL Window: A solution with Windows API."

But I think it would be useful and easier for the programmer to have a further parameter in the openWindow-statement to generate modal windows. In this case it is necessary to modify the closeWindow-routines to handle the modal functionality correctly (reactivating the calling window). Thank you.


Edited by - teachco on 17 June 2002 11:36:54