openWindow to createWindow, Hide-functions to Show-functions

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
es_91
Enthusiast
Enthusiast
Posts: 242
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

openWindow to createWindow, Hide-functions to Show-functions

Post by es_91 »

Wouldn't that make semantical sense?

'Opening' implicates that it already exists, but it's not even technically defined before.

In broader sense, should a new window not per default be invisible until shown using ShowWindow () function?, which btw would make more semantical sense than HideWindow () (?).
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: openWindow to createWindow, Hide-functions to Show-funct

Post by Dude »

Your wish is my command:

Code: Select all

Macro CreateWindow(Window,X,Y,InnerWidth,InnerHeight,Title,Flags=0,ParentWindowID=0)
  OpenWindow(Window,X,Y,InnerWidth,InnerHeight,Title,Flags|#PB_Window_Invisible,ParentWindowID)
EndMacro

CreateWindow(0,200,200,100,100,"test",#PB_Window_SystemMenu) ; Created invisibly.

Repeat

  ev=WaitWindowEvent(1)

  If GetAsyncKeyState_(#VK_CONTROL) & $8000
    HideWindow(0,#False) ; Show it when Ctrl is pressed.
  EndIf

Until ev=#PB_Event_CloseWindow
es_91
Enthusiast
Enthusiast
Posts: 242
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

Re: openWindow to createWindow, Hide-functions to Show-funct

Post by es_91 »

Well, i still ask for this sort of comfort.

Nice script kiddie-like API warm-up btw, Dude :mrgreen: .
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: openWindow to createWindow, Hide-functions to Show-funct

Post by Mistrel »

The reason for this is that it's using the "open/close" paradigm. If you just change it to "create" then suddenly it's "create/close" which is weird. That paradigm is typically "create/destroy".
Post Reply