trichview.com

trichview.support




Re: freeing controls


Return to index


Author

Message

Michael Philbrick

Posted: 02/13/2005 19:22:02


Sergey,


Yes, that makes sense.


Since I will only be using one instance at a time, I am currently using SelectControl/DeleteSelection

(based on some code in one of the newsgroup items) to "delete" the control,

something like this pseudocode:


btnYes.Create

AddControlEx(btnYes)

.. use the control ...

SelectControl

DeleteSelection


.. when the control is needed again ...


btnYes.Create

AddControlEx(btnYes)

.. use the control ...

SelectControl

DeleteSelection


.. etc.


All of this may be done BEFORE rvMacNav.Clear is called.


What exactly does DeleteSelection do? Does it free the memory for the control

just like Clear??


Would I be better off to create the instance once when I first format the

document and simply make the button visible/non-visible when I need it for

user input? I would have to move around the item (cut/paste) in code. If

this is a better way of doing things, could you give me the most efficient

code that selects an item and moves it to the end of a document?


Thank you.



"Sergey Tkachenko" <svt@trichview.com> wrote:

>Clear frees all the inserted components.

>But it does not modify external references to them (because it cannot).

>So btnYes variable remains not nil, but now it points to the freed memory.

>In this case, the result of calling (btnYes.Parent<>nil) is unpredictable

-

>it can return True, it can return False, it can generate access violation

>exception.

>

>You can use the buttons destructor, or rvMacNav.OnControlAction event to

>detect when the button is destroyed.

>

>





Powered by ABC Amber Outlook Express Converter