Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TopWindow&PopUp, TrayIcon » Modal vs non-modal window
Re: Modal vs non-modal window [message #12016 is a reply to message #12015] Mon, 08 October 2007 10:52 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14255
Registered: November 2005
Ultimate Member
NeonN wrote on Mon, 08 October 2007 03:14

Thx, i get it now... i wasn't thinking about that (making the dialow window class member). But I'm not very exited opening the window this way because it's IMHO wasting free memmory... the dialog window is allocated all the time when main window is running...

Maybe it's not so important for me because the app i am porting will be using at most 5-10 small dialogs... but anyway, i don't like it at all Sad....


Yep, that is, in theory, a valid concern.

Anyway, how big is subdialog? Single widget occupies 100-200 bytes, so it is usually less than 5KB. People tend to waste much more in other parts of code without even knowing Wink

Another important issue is that you will get access to the dialog, all its settings and values, for free. With new, you would in most cases needed to store a pointer to subdialog anyway.

OTOH, if the memory really is concern, you can use something like

class ClassName {
...
   One< WithLayout<TopWindow> > laySomething;
...
};

void ClassName::InitDlg()
{
...
   laySomething.Create();
...
}


In this case, data will be allocated on demand, while still keeping the advantage of deterministic cleanup.
 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: TopWindow Backup/Restore
Next Topic: Minor bug: TopWindow::GetStdSize()
Goto Forum:
  


Current Time: Mon Apr 28 18:16:40 CEST 2025

Total time taken to generate the page: 0.01053 seconds