Consultor Eletrônico



Kbase 16265: Dynamically created widgets and memory usage
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
Dynamically created widgets and memory usage

This Knowledge Base entry discusses a possible cause for the
fact that Progress uses more and more memory, and finally have the
Windows environment run out of resources.

The subject involved is Progress' handling of dynamic widgets.
Normally, if you delete a container widget, it's children will
also be deleted. This does not apply to pop-up menus or menu
bars, defined for that container.

More and more developers are building applications which
support the use of pop-up menu's to give their application
a true Windows 95 look (even under Windows 3.11). This is ok,
as long as you are aware of the fact that you explicitly have
to delete the pop-up menu before deleting the parent object.

The code below shows that the pop-up menu will be there after
you deleted the parent object:

DEFINE VARIABLE button-hdl AS HANDLE NO-UNDO.
DEFINE VARIABLE button-popup AS HANDLE NO-UNDO.

CREATE MENU button-popup
ASSIGN POPUP-ONLY = yes.

CREATE BUTTON button-hdl
ASSIGN POPUP-MENU = button-popup.

DELETE WIDGET button-hdl.

MESSAGE "Is the popup menu still valid? " SKIP
"Answer: " VALID-HANDLE(button-popup)
VIEW-AS ALERT-BOX.

The solution is to change the previous code to read:

IF VALID-HANDLE(button-hdl:POPUP-MENU) THEN
DELETE WIDGET button-hdl:POPUP-MENU.
DELETE WIDGET button-hdl.


References to written documentation:
-----------------------------------
Special Edition: Using PROGRESS V8

Progress Software Technical Support Note # 16265