Subject RE: [IBO] multiple questions...
Author Jason Wharton

Sorry for the delay in responding...

These are some very fruitful questions.

> I am doing data entry/edit forms right now and want to be able to
> enable/disable buttons for things like "Save/Cancel/Delete" etc.
> I have several MDI forms, so I just check like this to see if I can
> delete.
> DeleteButtonOnClick event:
> if ( DMLG1.IBC0.IB_Session.FocusedDataset <> nil ) and
> DMLG1.IBC0.IB_Session.FocusedDataset.CanDelete then
> DMLG1.IBC0.IB_Session.FocusedDataset.Delete;
> Is there a way to capture the "FocusedDataset" change event to
> enable/disable these buttons individually?

The work here has mostly already been done for you.

There is an entire system that does announcements and receivings of focus.
There are also some methods you may want to get familiar with to tighten
things up, like when a form activates and deactivates. (Using the
IBF_Base.pas for automates some of these issues too.)

The TIB_DataSource has the property AnnounceFocus that determines whether or
not the dataset will announce that it has the current dataset focus, then
other controls like TIB_UpdateBar, etc. have a property called ReceiveFocus
that determines whether or not it is listening for newly focusing
datasources and linking to them. There are also events like OnReceiveFocus
that will allow you to customize things if it isn't as cut and dry as
setting those properties.

> ______________________________________
> When I am in the edit forms and the cursor is not in an edit box or
> grid, the "FocusedDataSet" is nil, so I am unable to respond to a
> button press for say "New". Is there some general way around this,
> or is that the only way to read focus?

You can call the SetFocus method of the assumed default datasource for the
form when it activates. I think the IBF_Base class has handling for this
built into it. You may just look at it for an example to follow after.

> ______________________________________
> Are the prompt messages, like DeleteMessage, customizable with any
> field information like "Are you sure you want to delete %
> CustomerName%"?

I think it would be possible to do with Macro support but at this time I
don't have that capability. You may be able to write a BeforeDelete event
that would write in the more specific text to be used in the prompt.

> __________________________________
> Thanks for the great product. I'm only getting my feet wet, but it
> looks like it has a lot of potential to cut down on my coding work.

You are going to get a lot more than just your feet wet if you hang in there
and keep asking questions...

All the best,
Jason Wharton