Subject Re: [IBO] Multiple TIB_CtrlGrid causes Design Error
Author kumasoftllc
I have finally tracked down the source of the problem, and believe
that it might be a bug.

When I have a form with multiple TIB_CtrlGrids, each with the the
DataSource property set, I can consistently reproduce the problem by
doing 1 of 2 things:

1. Place a TIB_Memo in any of the grids.

or

2. Placing a TIB_ComboBox in any of the grid and setting the Style
to "csDrowDownList"

I have verified the root cause of the problem on both the original
form and a new form that I created from scratch (without using cut-
and-paste and paying careful attention to the creation order).

Any ideas?

Thanks.

Bob


--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> Bob,
> I thought I'd posted a reply to this one last week but just found
it in my
> unsent box. It might throw some light....
>
> At 01:08 AM 30/05/2003 +0000, you wrote:
> >I have a form containing 3 TIB_CtrlGrids.
> >
> >Each Grid has its DataSource property set to a different
datasource,
> >and contains various IBO edit, date, memo, and comboboxes.
> >
> >If I attempt to open this form first (design mode, not runtime)
after
> >opening the project I will receive the following error:
> >
> >error creating form: cannot focus a disabled or invisible window
>
> The cause of this error may be an embedded control whose Visible
property
> has not been reset to true. The quickest way to find it is to open
the DFM
> file as text and examine each of the embedded controls within its
parent
> control. In fact, you may find more than one such control; and
you might
> also find that something else is amiss with its embedding, such as
its
> creation order being out of sequence.
>
> >The only way I can open the form with these property settings is to
> >make sure I open another form (containing IBO components) prior to
> >opening the troublesome form.
>
> This gives rise to the suspicion of some misplaced parenting of
some
> control...did you perhaps copy-and-paste some controls from one
form to
> another and perhaps overlooked a parent setting, or the Visible
property?
>
> >As I permanent fix I have discovered that I can only have at most 2
> >TIB_CtrlGrids with the DataSource property set. As long as I leave
> >the DataSource property on 1 of the TIB_CtrlGrids (any one of the
> >three, it doesn't seem to matter) empty then the form will always
> >open even if I open it first (before another IBO-bearing form).
>
> Again, it looks like a parenting/creation order issue...
>
>
> >So my questions are:
> >
> >1. Can anyone provide any insight into this problem?
>
> Well, only that I have been where you are, if it is of any
comfort. I've
> learnt to take great care with the parenting and creation order
issues when
> dealing with embedded controls (being an avid copy/paster myself!!).
>
>
> >2. As far as I can tell, setting the DataSource on the TIB_CtrlGrid
> >is more of a convenience in that it prevents you from having to set
> >the DataSource individually on each of the widgets placed in the
> >control. There seems to be little other benefit to setting the
> >DataSource on the TIB_CtrlGrid itself. Is this correct?
>
> I hadn't thought about it from that angle and haven't tried it
without
> setting the parent datasource property. I can't remember having
more than
> two control grids on a single form, either, though. Without
setting up a
> sample (which I have no time for right now) I can't say whether you
have
> stumbled upon a "rule" of some sort. But the control grid is
intrinsically
> a fairly dumb container, so it would not surprise me if it turned
out to be
> the case that the Datasource properties of the individual embedded
controls
> would overrule.
>
> cheers,
> Helen