Re: TZF - Reusing a from
[email protected] Thu, 25 Sep 2003 23:08:56 EDT
| Newsgroups | gmane.comp.lang.delphi.topaz |
|---|---|
| Message-ID | <[email protected]> |
Hi Phil -
I don't normally reuse forms, so I am a novice on that subject.
I really should get proficient at that - as I am certain it would save
time. ... Being a novice, this may not help at all.
At one time, I did create a "parent form" with TzDBF objects with
the intent of inheriting from them. This maybe the first cousin of
your problem. However, I think my error message
had to do with "Alias name violation".
At run-time, I had to change the name of the TzDBF component to something
unique before opening it.
Our friend Chris from the UK helped me out in explaining this.
Here is what he said at that time:
________START CHIRS' EMAIL________________________________
> Hi Bob,
>
> I had this problem a few months back with an MDI application
> I was working on - each child form was opening a different
> DBF table.
> When I opened the second child form, it would complain that the
> alias name was already in use (because the components on the two
> forms had the same name)
>
> The fix for this is to set the name for the TzDbf component to
> something
> unique before opening it. Warning - this is a bit messy, but is the
> solution that was given to me by Alfred at SoftSCI:
>
>
> { create a unique component name - must start with a letter }
> s := 'DBF'+IntToStr(GetTickCount);
>
> Dbf.Name := s; { set the new component name for the TzDbf
> component }
>
> { changing component name resets its object reference -
> this is standard Delphi behaviour, but is very annoying }
> for i:=0 to Self.ComponentCount-1 do
> if Self.Components[i].Name=s then begin
> Dbf := TTzDbf(Self.Components[i]);
> break;
> end;
> { now you can set the DbfFilename and open the file safe in the
> knowledge that the Dbf component has a unique alias }
> Dbf.DbfFilename := somefile;
> Dbf.Open;
>
> Not exactly elegant is it!
> It also means if you have a DataSource hooked up, then you have to
> reset that, as changing the component name of the Dbf changes its
> object reference address!
>
> Hope this helps - let me know how you get on.
>
> Cheers,
>
> Chris
>
_________ END OF CHRIS EMAIL ___________________
Chris and I exchanged several emails ... if you want to "hear" more, then
let me know.
Thanks,
Bob
PS - How is the fall color in PA now?
____________________________________________________________
In a message dated 09/25/2003 1:29:25 PM Eastern Standard Time,
[email protected] writes:
> Howdy,
>
> Stupid me, I thought I would reuse a form and it isn't working. I declared a
> form with that contained all the databases in my application. The first
> project that I wrote using the database form works fine. When I started the
> second project I added the form to the project and everytime I try to open a
> database I get "Access violation at ####### in module 'CASHREG.EXE'. Read of
> address FFFFFFFF.
>
> I have tried creating a new DataForm and use it instead and I still get the
> error. Like I said the first project works.
>
> Am I loosing my touch or just my mind?
>
> Phil Kidder
>
>
--^----------------------------------------------------------------
This email was sent to: [email protected]
EASY UNSUBSCRIBE click here: http://topica.com/u/?clvXPN.a5kvff.Z2NsZHQt
Or send an email to: [email protected]
TOPICA - Start your own email discussion group. FREE!
http://www.topica.com/partner/tag02/create/index2.html
--^----------------------------------------------------------------