Page 1 of 1

App with multiple windows

Posted: Thu Nov 02, 2017 12:36 pm
by oO0XX0Oo
Hello,

I want to write an application that has one main window (and when it is closed I do NOT want
the whole application to exit but e.g. minimize to the system tray instead) and the main
window will have a few buttons, list icon gadgets, etc.

Double clicking a list icon gadget item / clicking on a button would open another window, that
itself can have gadgets as well.

What is the best way to handle several windows (that partially depend on another) when designing
the application, should each window reside in it's own procedure and how should events
for such a (sub)-window be handled?

Sorry, newbie here. I want to bring my application over from AutoHotkey to PureBasic...

Re: App with multiple windows

Posted: Thu Nov 02, 2017 12:41 pm
by Bisonte
Create your window, place all gadgets, hide it. Do this with all your windows at the beginning.

If you need to show a window, "unhide" it.

Only one Eventloop.

Thats all.

Re: App with multiple windows

Posted: Wed Nov 08, 2017 11:41 am
by oO0XX0Oo
Thanks you Bisonte, I'll try that :mrgreen:

Re: App with multiple windows

Posted: Wed Nov 08, 2017 5:00 pm
by infratec
And really:

Only 1 event loop

Code: Select all

Repeat
  
  Event = WaitWindowEvent()
  
  Select EventWindow()
    Case #MainWindow
      Exit = MainWindowEvents(Event)
    Case #OtherWindow
      OtherWindowEvents(Event)
  EndSelect
  
Until Exit
Bernd

Re: App with multiple windows

Posted: Sat Nov 11, 2017 2:36 pm
by oO0XX0Oo
@infratec
Only 1 event loop
Okay, works fine with multiple windows so far :D