[comp.sys.mac.programmer] Dialogs vs Windows

rubin@mead.UUCP (Daniel Rubin) (08/31/90)

I am new to the world of programming the Mac so please bare with me....

Are the opening and closing of Dialogs victimized by memory fragmentation
like the opening and closing of Windows are ????

In other words...  Will I run in to memory fragmentation proglems if I
open one main window and through out the course of the program execution
there are many many dialogs ????

i.e. I don't want to have to deal with handles if possible...

Thanks in advance for any help !			- Dan Rubin

jason@ux1.cso.uiuc.edu (Jason) (09/07/90)

rubin@mead.UUCP (Daniel Rubin) writes:

>Are the opening and closing of Dialogs victimized by memory fragmentation
>like the opening and closing of Windows are ????

   Yes, dialogs are windows (windows with some additional data appended to
the root window structure/record).

>In other words...  Will I run in to memory fragmentation proglems if I
>open one main window and through out the course of the program execution
>there are many many dialogs ????

   Perhaps.  If you have a program which uses various windows/dialogs at
varying times, one of the best methods is to allocate the windows and
dialogs just after the other standard initializations:

	1) maximize the application's zone
	2) use MoreMasters() to allocate the number of master pointers needed
	3) initialize the Toolbox
      * 4) use NewWindow(), NewDialog(), etc. to create the as many windows
	   as you need.
	5) (Forgive me if I have left anything out).

   In the case of a modal dialog, memory fragmentation is not such a big concern
since the dialog can be disposed of as soon as the user sends it away.  Here
the concern would simply be memory availability at the time the dialog needs
to be created.
-- 

                       |  |    |====================|
                       |  |    | Jason Watts        |
                     \ |\ |\ \ | (jazzin@uiuc.edu)  |