Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formset object that refuses to die

Status
Not open for further replies.

mibosoft

Programmer
Jul 23, 2002
106
SE
Hi,
I create my formset like this:
release INVOICE
public INVOICE
INVOICE=create("invoice")
INVOICE.show

In the init event of each button, label etc, I call a text translation function "gs" like:
this.Caption=gs(this.Caption)

The problem is that the second time I open my formset, some buttons and labels reminds their captions from last time even though I issue "release INVOICE" in the formset's detroy event. I have even put a test button in the toolbar that makes "release INVOICE" just to be sure to kill the object. Is this a bug?

/Micael

 
Micael,

, some buttons and labels reminds their captions from last time

Do you mean that these buttons and labels show the translated version, even before you call the GS() function? If so, are you sure about that? Remember, their Inits will fire before the form becomes visible so you should never see the original captions. If that's not the case, maybe the problem lies within GS()?

If I have misunderstood the situation, perhaps you could clarify.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Hi Mike,
Exactly, when setting a breakpoint on:
this.Caption=gs(this.Caption)

this.Caption already has the translated text the second time I enter the formset. Its like the button still exists in memory somehow. I don't think the formset object exist as I explicit make a release of it.

GS() works perfect for normal forms where I use the same technique.

/Micael
 
Micael,

Its like the button still exists in memory somehow.

The only way that could happen is if you have another object reference to the button (or form, or formset) somewhere. If you have a statement which is something like SomeOtherVariable = Invoice, and SomeOtherVariable isn't getting released, that might possibly explain it.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
No, I only create one object and call it once. What I thought of was, if the button (formset) happens to use exactly the same bytes in memory, the bytes holding the caption already has a value.

A funny thing is that it happens for some buttons and some labels but not all of them. I'm confused.

/Micael
 
Micael,

if the button (formset) happens to use exactly the same bytes in memory, the bytes holding the caption already has a value.

No, I wouldn't expect that to happen. When you instantiate an object, all the properties revert to either their default values or the values that you assigned to them at design time.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Mike,
the problem is solved!

The problem occurs when the caption text is given as ="myText". It think that style was used when auto translating my old v2.6 project. Changing into just myText fixes it.

Thanks for taking time!

/Micael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top