Subject RE: [IBO] Master/Detail - AfterOpen
Author Alan McDonald
Thanks Helen,
I can (could always) live with this - it's just not what I was used to...
BTW the scrollevent does not fire afteropen, nor does it fire after a
LookupKeyForFields called in the afteropen. I'm having to call it manually
in the afteropen event.

Alan

-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: Monday, 13 January 2003 12:20 AM
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] Master/Detail - AfterOpen


At 11:23 PM 12/01/2003 +1100, you wrote:
>Helen,
>"The Refresh of the detail set buffer during the master's scroll event
>involves a protected Close followed by a protected Open."
>
>thinking about this... and to avoid confusion...
>even if IBO uses a protected method for its afteropen and beforeclose
>magic... after IBO has done this magic.... surely the user is entitled to
>plug something into these events too?

This is the way it has appeared to me:

If your code calls Open, Close or Refresh on the dataset, you have access
to the event handlers for these methods. When a dataset's buffers are
being controlled by a masterlinking, you don't have access to those
handlers because they are internal calls - you are not calling Open and
Close yourself. The reasoning I understand for this is that the
masterlinking requires the events to proceed in a particular sequence,
without interference from handlers it doesn't control.

Hence, knowing that the master's scroll activity is going to close the
dataset (if it is open) and finally reopen it to bring new contents into
the buffer, you simply call your handler code from the master's scroll
events.

Although I don't think I've ever needed to do it, other than where I'm
switching mastersources, I don't know of any reason why you couldn't close
and reopen a detail set yourself if you had some need to do it. Have you
tried to do it?

A propos your earlier comment, that the master's scroll events wouldn't be
available when you open master for the first time: I'm fairly sure that
the first scroll event happens when the buffer pointer moves from BOF to
row 0. I haven't tested it in battle, though. But, if it turned out that
it didn't, it still wouldn't be a problem for me. My handler code routines
live outside the event blocks. I just call them from whatever event(s)
need to call it.

Why not set up a little test app for yourself, if it's an issue for you, to
find out precisely what events occur when a master/detail structure opens
for the first time? If you do, don't forget to report back, because an FAQ
on the subject might turn out to be useful.

cheers,
Helen




___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/