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: 1313
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.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
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: 7618
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