CloseWindow()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: CloseWindow()

Post by netmaestro »

Fred wrote:...and to be honest I don't understand anything in your request.
Oh good, it's not just me then!
BERESHEIT
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re: CloseWindow()

Post by Kuron »

netmaestro wrote:Oh good, it's not just me then!
Add me to the list of those confused.
Best wishes to the PB community. Thank you for the memories. ♥️
mestnyi
Addict
Addict
Posts: 1000
Joined: Mon Nov 25, 2013 6:41 am

Re: CloseWindow()

Post by mestnyi »

And how here here native functions pb to learn that your window was closed?

Code: Select all

;-TOP

DeclareModule MyDialog
  
  Declare Open(ParentWindow)
  
EndDeclareModule

Module MyDialog
  
  Global win
  
  Procedure CloseDialog()
    ; Unbind
    UnbindEvent(#PB_Event_CloseWindow, @CloseDialog(), win)
    UnbindEvent(#PB_Event_CloseWindow, @CloseDialog(), ParentWindow)
    Debug "ToDo Close Diaglog ..."
    If EventWindow() = win
      Debug "Close from dialog"
    Else
      Debug "Close from main"
    EndIf
    CloseWindow(win)
    Debug "Ready."
  EndProcedure
  
  Procedure Open(ParentWindow)
    win = OpenWindow(#PB_Any, #PB_Ignore, #PB_Ignore, 300, 200, "MyDialog", #PB_Window_Tool | #PB_Window_SystemMenu, ParentWindow)
    
    
    ; Bind
    BindEvent(#PB_Event_CloseWindow, @CloseDialog(), win)
    BindEvent(#PB_Event_CloseWindow, @CloseDialog(), ParentWindow)
    
    ; Code
    ProcedureReturn win
  EndProcedure
  
EndModule

; Help window for dispatch events - We needed allway one window for do events
Global MyHideWindow = OpenWindow(#PB_Any,0,0,0,0, "DoEvents", #PB_Window_Invisible | #PB_Window_NoGadgets); | #PB_Window_NoActivate)

Global ExitApplication, MyDialog

Procedure CloseMain()
  Debug "ToDo Close MainWindow ..."
  Debug "Ready."
  CloseWindow(0)
  ExitApplication = #True
EndProcedure


Procedure Main()
  
  If OpenWindow(0, #PB_Ignore, #PB_Ignore, 400, 300, "Main", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
    ButtonGadget(1, 10,10,100,30,"CloseDialog")
    
    BindEvent(#PB_Event_CloseWindow, @CloseMain(), 0)
    MyDialog = MyDialog::Open(0)
    Repeat
      Select WaitWindowEvent()
        Case #PB_Event_Gadget
          Select EventGadget()
            Case 1
              CloseWindow(MyDialog)
          EndSelect
          
        Case #PB_Event_CloseWindow
          If EventWindow() = 0
            ;CloseWindow(0)
            Break
          EndIf
      EndSelect
      
    Until ExitApplication
    
  EndIf
  
EndProcedure : Main()

End
You do not think that I do not know this approach

Code: Select all

DeclareModule MyDialog
  
  Declare Open(ParentWindow)
  Declare CloseDialog()
EndDeclareModule

Select EventGadget()
            Case 1
              MyDialog::CloseDialog();CloseWindow(MyDialog)
          EndSelect
I know that there is no ideal programming language
But this does not mean that you do not need to improve your language.
So I wanted a logical flexibility. If you do not need it, let it be yours.
My native language is not English but Akhvah(Ахвахский), so it's hard for me to explain to you. :D
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: CloseWindow()

Post by nco2k »

- you ask a question
- you get the answer
- you ignore the answer and ask the same question again
- you get another answer
- you ignore the answer again and ask the same question one more time

this sums up pretty much every single one of your threads, and its super annoying.

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
mestnyi
Addict
Addict
Posts: 1000
Joined: Mon Nov 25, 2013 6:41 am

Re: CloseWindow()

Post by mestnyi »

this sums up pretty much every single one of your threads, and its super annoying.
I would not want to annoy you, but if I see that you do not understand what I'm asking. So can not you try again to explain this to you?
Here you are, for example, what do you say, in my penultimate post, that's how in the modules of the module I find out that my window has been closed if I imagine that the module I am writing a program with my module you write?
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: CloseWindow()

Post by nco2k »

IsWindow() for the 100th time:

Code: Select all

OpenWindow(0, 0, 0, 200, 100, "")
Debug IsWindow(0)
CloseWindow(0)
Debug IsWindow(0)
or like i said, you could use a Callback:

Code: Select all

Procedure WndProc(hWnd, uMsg, wParam, lParam)
  If uMsg = #WM_DESTROY
    Debug "#WM_DESTROY"
  EndIf
  ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

OpenWindow(0, 0, 0, 200, 100, "")
SetWindowCallback(@WndProc(), 0)
CloseWindow(0)
i dont mind that your english isnt the best. thats not the issue. the issue is, that people are trying to help you, but you arent willing to put the slightest bit of effort from your end. if you want to make things work in a programming language, you have to... you know... do a little bit of programming yourself.

you have all the tools you need, but instead you are posting bug reports and feature requests, that should fix all the problems you created on your own. instead of copy+pasting the examples and complaining that they are not working the way you want them to, maybe you should try to understand them first and then adjust them to your needs.

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
mestnyi
Addict
Addict
Posts: 1000
Joined: Mon Nov 25, 2013 6:41 am

Re: CloseWindow()

Post by mestnyi »

IsWindow() for the 100th time:
Well this is ridiculous. I explain why, and where will I check if my window exists? In a stream or in a timer? :)

Code: Select all

Procedure WndProc(hWnd, uMsg, wParam, lParam)
  If uMsg = #WM_DESTROY
    Debug "#WM_DESTROY"
  EndIf
  ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

OpenWindow(0, 0, 0, 200, 100, "")
SetWindowCallback(@WndProc(), 0)
CloseWindow(0)
That's the type of this I need but only cross-platform
you have all the tools you need, but instead you are posting bug reports and feature requests, that should fix all the problems you created on your own. instead of copy+pasting the examples and complaining that they are not working the way you want them to, maybe you should try to understand them first and then adjust them to your needs.
Here you are right, what if I want to improve the tool that I chose
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re: CloseWindow()

Post by Kuron »

mestnyi wrote:what if I want to improve the tool that I chose
Only an arrogant and shoddy programmer expects a programming language to conform to his needs. A good programmer will adapt to the programming language he is using. If a programming language does not meet his needs, he will go find one that does. You might be happier with another programming language.
Best wishes to the PB community. Thank you for the memories. ♥️
mestnyi
Addict
Addict
Posts: 1000
Joined: Mon Nov 25, 2013 6:41 am

Re: CloseWindow()

Post by mestnyi »

Only an arrogant and shoddy programmer expects a programming language to conform to his needs.
And this is probably the stupid opinion of some programmers
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: CloseWindow()

Post by nco2k »

>> where will I check if my window exists?
wherever you need it.

>> this I need but only cross-platform
then make it cross-platform.

>> what if I want to improve the tool that I chose
by dumbing it down, because you dont understand basic purebasic mechanics?

>> this is probably the stupid opinion of some programmers
he is right though.

i honestly dont understand how you even expect this to work. #WM_DESTROY notifies you that the window has been destroyed. (Wait)WindowEvent() requires at least one open window to work. but the window has been destroyed. its gone. you wouldnt even receive a #PB_Event_DestroyWindow message. your event loop would simply go poof. but of course you havent thought about that.

anyway, all has been said and im done with this topic. if you dont want to put any effort into learning and understand basic purebasic mechanics, then thats your choice, and luckily none of my business.

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
mestnyi
Addict
Addict
Posts: 1000
Joined: Mon Nov 25, 2013 6:41 am

Re: CloseWindow()

Post by mestnyi »

>> Где я могу проверить, существует ли мое окно?
где бы вы ни нуждались.

>> Мне это нужно, но только кросс-платформу,
тогда сделайте ее кросс-платформенной.
From this I understand that it does not make sense to talk to you.
Then, as it was clear what I'm talking about, you intend to ignore it. :(
Little John
Addict
Addict
Posts: 4527
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: CloseWindow()

Post by Little John »

netmaestro wrote:
Fred wrote:...and to be honest I don't understand anything in your request.
Oh good, it's not just me then!
Dear Fred, netmaestro and others ... you do not understand?
Maybe reading his "other" feature requests about closing windows will shed some light on the case? :mrgreen:

WaitWindowClose()
WaitCloseWindow()
WindowClose
IsCloseWindow
User avatar
mk-soft
Always Here
Always Here
Posts: 5393
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: CloseWindow()

Post by mk-soft »

I don't understand the problem. It is the programmer's thing when the window should be closed.

If someone does not know how to program it, I have the' modul_myevents'.
This returns an event that destroyed a gadget or window
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply