Page 1 of 1

openWindow to createWindow, Hide-functions to Show-functions

Posted: Sat Mar 03, 2018 10:06 am
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 () (?).

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

Posted: Sat Mar 03, 2018 10:16 am
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

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

Posted: Sat Mar 03, 2018 10:59 pm
by es_91
Well, i still ask for this sort of comfort.

Nice script kiddie-like API warm-up btw, Dude :mrgreen: .

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

Posted: Mon Mar 05, 2018 1:54 am
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".