On Fri, Nov 23, 2012 at 4:52 AM, Staffan Tylen <staffan.ty...@gmail.com>wrote:
> Thanks Mark, I was almost correct :) Reading up on createFontEx I find the
> following: *When the programmer is done with the font, the operating
> system resources used by the font can be released with the deleteFont()
> method.* I'm not sure what "is done with the font" means. If I do
> createFontEx -> setFont -> deleteFont to modify the font in an editcontrol,
> will that work or do I need to wait with deleteFont until the editcontrol
> is no longer used, i.e. the dialog is about to close?
>
It is the second. Do not delete a font that is being used. When you set a
font in a dialog control, it is being used. A good place to delete the
font would be in the leaving() method of the dialog that owns the edit
control.
However, you really only need to worry about deleting it, if your the
dialog is closed, but your program keeps running.
When the Rexx interpreter process ends, the operating system reclaims any
system resources your program was using. So, take a typical short example
program I post that goes something like this:
dlg = .Dlg~new
dlg~execute
return 0
::requires 'ooDialog.cls'
::class 'Dlg' ...
methods ...
In the above, when the execute() method ends, we fall out of the main part
of the program and the interpreter process ends. You don't need to delete
the font there. But, it doesn't hurt to delete it either.
On the other hand say you wrote some type of program that never closes. It
just continually puts up dialogs, the user interacts with the dialog, then
closes the dialog. The program continues running and puts up another
dialog.
In an application like that, if you didn't delete the font, the program
over time would use more and more memory. And, the number of logical fonts
available would slowly decrease.
That is the type of scenario where deleting the font is important. There
is a limit on the number of logical fonts that can be created. It is a big
number, but it is a finite number. Eventually the program wouldn't be able
to create a new font to assign to the edit control.
--
Mark Miesfeld
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users