I have a form that enables-disables buttons and menu items according to the
state of a DataSource conneted to a paradox TTable on that form. Everything
was fine untill I noticed a problem when minimizing the form.
If I choose "New" (a speedbutton) to create a new order putting the TTable in
Edit mode all the buttons and menu items sync just fine, as the same in browse
or delete mode, etc.
But if I choose "New" to create a new order, MINIMIZE the form, and then
MAXIMIZE it, the buttons reflect a browse state, or the state the form would be
in AFTER the user had selected to POST or CANCEL the transaction with the
Orders TTable object.
Here is the procedure and code for the Orderstable;
________________________________________________________
procedure TOperationsForm.OrdersDataSourceStateChange(Sender: TObject);
begin
{Sync Buttons on OrderForm}
if Orderstable.State = dsInsert then
begin
NewOrderBtn.Enabled := False;
EditOrderBtn.Enabled := False;
PostOrderBtn.Enabled := True;
CancelOrderBtn.Enabled := True;
DeleteOrderBtn.Enabled := False;
JobItemsBtn.Enabled := True;
OrdersbyCustomer1.Enabled := False;
EditingRecords := True;
end
else if
Orderstable.State = dsEdit then
begin
NewOrderBtn.Enabled := False;
EditOrderBtn.Enabled := False;
PostOrderBtn.Enabled := True;
CancelOrderBtn.Enabled := True;
DeleteOrderBtn.Enabled := False;
JobItemsBtn.Enabled := True;
OrdersbyCustomer1.Enabled := False;
EditingRecords := True;
end
else if
Orderstable.State = dsBrowse then
begin
NewOrderBtn.Enabled := True;
EditOrderBtn.Enabled := True;
PostOrderBtn.Enabled := False;
CancelOrderBtn.Enabled := False;
DeleteOrderBtn.Enabled := True;
JobItemsBtn.Enabled := False;
OrdersbyCustomer1.Enabled := True;
EditingRecords := False;
end;
end;
________________________________________________________
I do notice by a label's caption, that the TTable object is still in Edit mode,
yet the button's states have changed.
Can someone tell me what might be going wrong here?
Thanks a bunch!
----
RKR
****************************************
E-Mail: r...@primenet.com
****************************************