Subject Re: [IBO] Cannot post current row
Author Helen Borrie
At 10:41 AM 30-11-00 +0100, you wrote:
>Hi,
>
>I have got a problem using a TIB_UpdateBar:
>I have some TIB_Edits, a TIB_Datasource an a
>TIB_Query in a form and it works well to insert
>data.
>
>When I change a record and click the post button
>of the TIB_Updatebar, the data is saved.
>
>But then I defined a hotkey which calls TIB_UpdateBar.BtnClick(ubPost)
>so that the user does not need to use the mouse.
>But when pressing the key I get the error message "Cannot post current
>row".
>
>Anyone? :-(


I think you are going to have to add more code to your hotkey handler, i.e.
before you let it call the buttonclick, first test
if (MyDataset.State in ([dssEdit, dssInsert, dssDelete])) then
IB_UpdateBar.BtnClick(ubPost)
else
Beep;

Or you could access the NeedToPost property of the ib_datasource, e.g.

with IB_UpdateBar do
if Datasource.NeedToPost then
BtnClick(Post)
else
PlaySound('Uh-Oh.wav');

Helen

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________