I see some classes in FWH have a method by name Destroy(). If we name a method as Destroy, will it be called automatically, when the object goes out of reference ?
xharbour documentation mentions about DESTROYER method. Does it also called automatically?
Can any one clarify please?
(x)harbour class - destroy method
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
(x)harbour class - destroy method
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Nageswararao,
>
I see some classes in FWH have a method by name Destroy(). If we name a method as Destroy, will it be called automatically, when the object goes out of reference ?
>
FWH automatically calls method Destroy() when a windows msg WM_DESTROY arrives:
http://msdn2.microsoft.com/en-us/library/ms632620.aspx
>
xharbour documentation mentions about DESTROYER method. Does it also called automatically?
>
FWH does not uses those methods, in order to have full control of what it is happening in the application
>
I see some classes in FWH have a method by name Destroy(). If we name a method as Destroy, will it be called automatically, when the object goes out of reference ?
>
FWH automatically calls method Destroy() when a windows msg WM_DESTROY arrives:
http://msdn2.microsoft.com/en-us/library/ms632620.aspx
>
xharbour documentation mentions about DESTROYER method. Does it also called automatically?
>
FWH does not uses those methods, in order to have full control of what it is happening in the application
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
I have some related doubts about releasing objects like fonts, brushes etc. Normally I place the commands release fonts and other objects after the main (mdi) window's activate command. Example
1) IF somewhere in one of the modules if we call WndMain():End(), does the control go to the statements after the main window's activate command and execute all release commands?
2) If somewhere in one of the modules if we issue the statement QUIT, is there the danger that the resources are not destroyed/ released?
if so, is it good to keep the release statements in the EXIT PROCEDURE ?
Or is it desirable that all FWH classes for the resources have a destroy method, so that all the resources are destryoyed / released when the program terminates?
Code: Select all
func main()
define window ownd MDI ....
.........
activate window ownd
release font ...
release brush ...
return 0
1) IF somewhere in one of the modules if we call WndMain():End(), does the control go to the statements after the main window's activate command and execute all release commands?
2) If somewhere in one of the modules if we issue the statement QUIT, is there the danger that the resources are not destroyed/ released?
if so, is it good to keep the release statements in the EXIT PROCEDURE ?
Or is it desirable that all FWH classes for the resources have a destroy method, so that all the resources are destryoyed / released when the program terminates?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Yes.nageswaragunupudi wrote:1) IF somewhere in one of the modules if we call WndMain():End(), does the control go to the statements after the main window's activate command and execute all release commands?
Yes. Example:nageswaragunupudi wrote:2) If somewhere in one of the modules if we issue the statement QUIT, is there the danger that the resources are not destroyed/ released?
Code: Select all
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oWnd
DEFINE WINDOW oWnd
@ 1, 1 BUTTON "Test";
SIZE 100, 20;
ACTION oWnd:End() //MYQUIT()
ACTIVATE WINDOW oWnd
? "Exiting"
RETURN NIL
STATIC FUNCTION MYQUIT()
QUIT
RETURN NIL
How an EXIT PROCEDURE could see all the variables used in the app for keeping reference of font, brush, etc.? It seem a bad idea.nageswaragunupudi wrote:if so, is it good to keep the release statements in the EXIT PROCEDURE ?
Maybe the easier solution is to not use QUIT at all.
EMG
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: