#PB_Window_Modal

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Straker
Enthusiast
Enthusiast
Posts: 701
Joined: Wed Apr 13, 2005 10:45 pm
Location: Idaho, USA

#PB_Window_Modal

Post by Straker »

Pretty please?

[edit]
Oh yeah - and cross-platform.
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Post by USCode »

Straker
Enthusiast
Enthusiast
Posts: 701
Joined: Wed Apr 13, 2005 10:45 pm
Location: Idaho, USA

Post by Straker »

Yeah I saw that thread. Can it be done in one line?

I don't want to start this debate again.... it has been done extensively already. Here is the psuedo-code I am looking for:

Code: Select all

OpenWindow(#Window_0,10,10,100,200,#PB_Window_Modal)
I don't know, but it seems easier to me.

Could just be me though.

Could just be all those braincells I lost in my youth.

Maybe I am just crazy....
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Its a common feature in other languages. So maybe for a future version, why not.
quidquid Latine dictum sit altum videtur
Straker
Enthusiast
Enthusiast
Posts: 701
Joined: Wed Apr 13, 2005 10:45 pm
Location: Idaho, USA

Post by Straker »

Thanks freak.
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

ShowWindow...

Post by USCode »

:idea: Until it is a formal part of the language, seems like you could create the window as it is currently done and then create your own custom prodedures that encapsulate the DisableWindow, StickyWindow and SetActiveWindow calls to emulate displaying a modal window.

For example, maybe create a routine you could call
"ShowWindowModal(your_window_#)"
and that routine would make your window active with modal behavior.

Or even;

"ShowWindow(your_window_#, boolean)"
with the boolean parameter used to determine the window modality (whether to use DisableWindow or not). I believe Delphi and other languages work like that, determining their modality when the window is shown, not when it is created.

If I have some time I'll try and throw something together to demonstrate what I mean.

HTH
Straker
Enthusiast
Enthusiast
Posts: 701
Joined: Wed Apr 13, 2005 10:45 pm
Location: Idaho, USA

Post by Straker »

Thanks USCode.

Yes, I am not opposed at all in writing my own functions to extend the language. I have done this many times anyway. This one just seems so obvious that it should be in the language.

In the meantime....

SetWindowModal(#Window_0)

Will do.

Thanks for the feedback.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: #PB_Window_Modal

Post by PB »

And also #PB_Window_ToolWindow would be nice, to avoid having to do it
later like this:

Code: Select all

SetWindowLong_(hWnd,#GWL_EXSTYLE,GetWindowLong_(hWnd,#GWL_EXSTYLE) | #WS_EX_TOOLWINDOW)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
USCode
Addict
Addict
Posts: 923
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: #PB_Window_Modal

Post by USCode »

PB wrote:And also #PB_Window_ToolWindow would be nice
I haven't worked with it yet but would the new StickyWindow work here for you PB?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: #PB_Window_Modal

Post by PB »

> would the new StickyWindow work here

StickWindow <> ToolWindow. :)

StickWindow = Always on top -> SetWindowPos_(hWnd,#HWND_TOPMOST,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE)
ToolWindow = Not in the Taskbar -> SetWindowLong_(hWnd,#GWL_EXSTYLE,GetWindowLong_(hWnd,#GWL_EXSTYLE)|#WS_EX_TOOLWINDOW)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Axolotl
Addict
Addict
Posts: 802
Joined: Wed Dec 31, 2008 3:36 pm

Re: #PB_Window_Modal

Post by Axolotl »

I came across this topic while browsing today.
From my point of view, this feature would be helpful. That's why I'm pulling it out of the depths of the forum. :oops:
Maybe this comment gives hope:
freak wrote: Wed Feb 22, 2006 1:35 pm Its a common feature in other languages. So maybe for a future version, why not.
BTW: I know about the "workarounds" -- and I am just working on my own.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Post Reply