TPanel & Codejock

TPanel & Codejock

Postby TimStone » Thu May 30, 2013 6:58 pm

Using: xHarbour(.com) August 2010 , FWH 13.04 build
With: Latest Codejock implementation from Richard CHIDIAK

This is an error that is not happening consistently. It occurs on two computers at a client's location.

When creating a new calendar window, the TPanel class is called :
::oPanelCalex = TPanel():New( 0, 175, ( nHeight ), ::oCwnd:nWidth, ::oCwnd:oWndClient )

Most of the time it works fine

Sometimes there is an error:
TPanel, Cannot find Window Class
TPanel:New( 49 )
:Create(739)
:createerror( 758)

Any thoughts on how to eliminate this problem ? Thanks.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: TPanel & Codejock

Postby Richard Chidiak » Thu May 30, 2013 7:30 pm

Tim

Make sure you have ::opanelcalex := nil in the end method

in my end method i have all these

::oCalexStdDlgs := nil
::oGlbSettings := nil
::opanelCalex := nil
::opaneldtp := nil
::oDtPick := nil
::oCalex := nil

my guess is that the customers enter and exit several times the calendar and if the object is not properly ended , at a moment it can not create it. (Just a guess, it fails at creation of the panel so it can make sense).

I do not have (so far) any of my customers reporting similar problem.

Hth

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: TPanel & Codejock

Postby TimStone » Thu May 30, 2013 7:41 pm

::oCalex was not in my end

::oPanelDTP does not exist in my class.

Thanks. These people use the appointment scheduler very aggressively.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: TPanel & Codejock

Postby James Bott » Fri May 31, 2013 12:11 am

Tim and Richard,

You should be calling the panel's End() method when you are done with it.

oPanelCalex:end()

I would not just set it to nil. The TPanel class doesn't have it's own End() method but it does inherit from TControl which does. And TControl's End() method also calls TWindow's End() method. There are routines in these two parent classes' End() methods that need to be called when a panel object is done.

You should always call the End() method of any object when you are done with it.

Tim, I don't know if this will solve your current problem, but it needs to be done anyway.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: TPanel & Codejock

Postby Enrico Maria Giordano » Fri May 31, 2013 8:00 am

James Bott wrote:You should always call the End() method of any object when you are done with it.


Not always. Often the owner takes care of releasing the object (at least in FWH).

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: TPanel & Codejock

Postby James Bott » Fri May 31, 2013 12:24 pm

Enrico,

I knew you would get me on that one. Yes, you are correct, however, it seems easier to just to adopt a policy of ending any objects you create than to figure out if the owner object is doing it. Further, if you are having problems that seem to be helped by setting objects to nil, then you should be using End() instead.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: TPanel & Codejock

Postby Enrico Maria Giordano » Fri May 31, 2013 12:37 pm

James,

James Bott wrote:Enrico,

I knew you would get me on that one. Yes, you are correct, however, it seems easier to just to adopt a policy of ending any objects you create than to figure out if the owner object is doing it. Further, if you are having problems that seem to be helped by setting objects to nil, then you should be using End() instead.

James


Are you saying that we should explicit End() GETs, COMBOs and so on? :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: TPanel & Codejock

Postby James Bott » Fri May 31, 2013 2:38 pm

Enrico,

Are you saying that we should explicit End() GETs, COMBOs and so on?


No, as you pointed out all controls on a dialog are ended by the dialog.

I do end fonts, panels, database objects, etc.

Like I said before, if setting an object to nil is helping, then one should be using end() instead.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: TPanel & Codejock

Postby Enrico Maria Giordano » Fri May 31, 2013 2:58 pm

James,

James Bott wrote:Enrico,

Are you saying that we should explicit End() GETs, COMBOs and so on?


No, as you pointed out all controls on a dialog are ended by the dialog.


I know that. I was joking. :-)

James Bott wrote:I do end fonts, panels, database objects, etc.

Like I said before, if setting an object to nil is helping, then one should be using end() instead.

James


I agree. But as far as I know, setting an object to nil would help only if the variable hosting the object reference were STATIC. Otherwise, the garbage collector will do its good work when the variables goes out of scope.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: TPanel & Codejock

Postby James Bott » Fri May 31, 2013 3:11 pm

Enrico,

But as far as I know, setting an object to nil would help only if the variable hosting the object reference were STATIC.


I do see a lot of people using statics. I hardly ever do since I use mostly classes. All my class objects are Locals.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: TPanel & Codejock

Postby Enrico Maria Giordano » Fri May 31, 2013 5:03 pm

James,

James Bott wrote:Enrico,

But as far as I know, setting an object to nil would help only if the variable hosting the object reference were STATIC.


I do see a lot of people using statics. I hardly ever do since I use mostly classes. All my class objects are Locals.

James


So you don't need to set your variables to NIL. :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], karinha and 116 guests