[futurebasic] Re: When to dispose of Hndl& and Ptr&?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: Bill Kuck <bypass91@...>
Date: Mon, 8 Dec 1997 01:59:15 -0500
On Sat, 6 Dec 1997 Mark wrote,

>Just want to make sure that you are totally clear on something that Rick
>pointed out in an earlier post.  See below.
>  efHndl& = TEHANDLE(efID%)   'create a temp handle to ef
>Your comment beside the satement above may or may not be correct depending
>on what you mean by "create a temp handle".  Here you are not creating the
>memory block itself; FB did this when you created the EDIT FIELD.  Instead,
>you are making a copy of a value which points to the block (actually, which
>points to the master pointer which points to the block).  If you were, at
>this point to write "efHndl&=0", then it would not affect the memory block
>at all.  Of course, this fact is irrelevant to your current code--but it's
>good to be aware of it anyway.

Yep, that's what I meant... You are very observant!  I did it this way to
see if I understood what 'copies of handles' meant in Rick's earlier
comments.  I chose the edit field approach to try to trip myself up and get
you guys to catch me... and you did.

By creating an edit field in my Main section and calling a Local FN that
accesses that edit field would require that the FN see the edit field
(memory block).  Since I did not want to create a global handle to the edit
field and use it inside the FN, I tried something else to test my
understanding.  I purposely passed the edit field ID to the FN and created
a handle (temporary variable) from it.  You see, I believed that the edit
field ID was also a handle.. or whatever, as it was tied to that edit
field.  Since what goes on inside an FN is local to itself, the new handle
was just going to be another tie to that edit field.  Now, if I was to
dispose of the temporary handle by using DEF DISPOSEH(efHndl&) thinking
that it would do away with the handle only, I would have been mistaken.
All I would have done would be to tell Mr. MacOS to dump the edit field
(memory block) using that temporary handle to do it with.

I knew then that exiting the FN would delete the temporary handle, but,
that would be ok.  I would have kept the edit field intact.

Thanks for your comments and insight.

PS  New computer on the market!  A Marv Albert computer that has 16-bytes
and no memory.