--- In [email protected], "brucexs" <bswit...@...> wrote: > > --- In [email protected], "entropyreduction" > <alancampbelllists+yahoo@> wrote: > > > > --- In [email protected], "brucexs" <bswitzer@> wrote: > > > > > If it is a button or other window that PowerPro draws, the font > > > is usually created and kept for the lifetime of the window and > > > destroyed on wm_destroy. Fonts that go across windows (eg own > > > default font for all bars) are created and destroyed at each > > > reconfigure, I think (I have not checked code). > > > > ...so it's not a good idea, in dialog.set_font, to attempt to > > delete an HFONT retrieved from a bar with WM_GETFONT (in order to > > remove old font afternreplacing it with a new one); I might be > > deleting font used by all bars. > > > > PowerPro keeps the font handles outside of the window and only > puts them in the device context before drawing. So this is not a > good idea nor do I think it will accomplish anything in general.
I found a nice utility, and indeed I was previously wasting resources by not deleting or reusing fonts on the debug window. http://www.nirsoft.net/utils/gdi_handles.html I'm experimenting with reusing my custom fonts on the debug window. I think I prefer this to needing to click a caption button to close the window. First time debug is shown, I use the dialog plugin to create and set all the control fonts. The handles are saved in a small vector (currently I have to use WM_GETFONT messages to get them - just after dialog has set them. I think it would be useful if dialog.set_font could return the handle to the font that got set.). On subsequent uses of the debug window, I reload the saved fonts from the vector using WM_SETFONT messages. WM_SETFONT has a parameter that must be 1 to immediately change the control. Possibly that is what is lacking when cl.setfont is used on embedded controls. Calling cl.refresh after cl.setfont risks losing other content besides the old font. Regards, Sheri
