 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
b Guest
|
Posted: Mon Jul 28, 2003 10:04 pm Post subject: how can reset the objects? |
|
|
if i use a TEdit inside a Form. when i close this and then i reopen i can
see the old text inside the TEdit box.
how can when i close the Form, reset all the variables, and all the object
used inside?
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Jul 28, 2003 10:39 pm Post subject: Re: how can reset the objects? |
|
|
"b" <borland.public.cppbuilder.vcl.components.using> wrote
| Quote: | if i use a TEdit inside a Form. when i close this
and then i reopen i can see the old text inside the TEdit box.
|
You did not destroy the form when you closed it. You merely hid it and then
reshowed it later.
| Quote: | how can when i close the Form, reset all the variables,
and all the object used inside?
|
Either:
1) completely destroy the form when it closes and then instantiate a new
instance fresh each time you want to show the form
2) use the form's OnClose event to manually clear the desired components
directly
Gambit
|
|
| Back to top |
|
 |
Giuliano Guest
|
Posted: Mon Jul 28, 2003 10:53 pm Post subject: Re: how can reset the objects? |
|
|
On Tue, 29 Jul 2003 00:04:58 +0200, "b"
<borland.public.cppbuilder.vcl.components.using> wrote:
| Quote: | if i use a TEdit inside a Form. when i close this and then i reopen i can
see the old text inside the TEdit box.
how can when i close the Form, reset all the variables, and all the object
used inside?
|
One approach could be the following:
a) remove the form from the list of the auto created forms.
b) create your form manually upon opening (e.g. using new or
TApplication::CreateForm); when a form is in order to be
created, it loads itself from the application resources.
c) destroy the form when you don't need for it anymore.
A second approach could be this:
a) go into directory $(BCB)ExamplesAppsRichEdit and copy
the file reinit.pas in your project directory.
b) you have to massage the file reinit.pas by adding the following
row a line just before of the keyword "implementation":
function ReloadInheritedComponent(Instance: TComponent; RootAncestor:
TClass): Boolean;
c) compile first that unit (e.g. using Alt+F9); doing so, you have
obtained a file named reinit.hpp; you have to include that file in
the C++ source which will have to restore the original state of
the form.
d) finally, when you need to restore your form as the first time, call
ReloadInheritedComponent( TheFormYouWantRestore, __classid( TForm ) );
You can be sure that the modifications you have done at runtime to the
properties or events will be lost, by means of restoration of the original
conditions of the form.
HTH
Giuliano
|
|
| Back to top |
|
 |
Giuliano Guest
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|