App with multiple windows

Windows specific forum
oO0XX0Oo
User
User
Posts: 78
Joined: Thu Aug 10, 2017 7:35 am

App with multiple windows

Post 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...
User avatar
Bisonte
Addict
Addict
Posts: 1226
Joined: Tue Oct 09, 2007 2:15 am

Re: App with multiple windows

Post 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.
PureBasic 6.04 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
oO0XX0Oo
User
User
Posts: 78
Joined: Thu Aug 10, 2017 7:35 am

Re: App with multiple windows

Post by oO0XX0Oo »

Thanks you Bisonte, I'll try that :mrgreen:
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: App with multiple windows

Post 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
oO0XX0Oo
User
User
Posts: 78
Joined: Thu Aug 10, 2017 7:35 am

Re: App with multiple windows

Post by oO0XX0Oo »

@infratec
Only 1 event loop
Okay, works fine with multiple windows so far :D
Post Reply