DataSourceDataChange event fires when form is minimized? 
Author Message
 DataSourceDataChange event fires when form is minimized?

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

****************************************

****************************************



Sat, 27 Feb 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Knowing when I am minimized

2. OnDataChanged event not fired in Master-Detail setup

3. Newbie question: disabling event firing in component

4. how to fire a ttable's OnFilterRecord event

5. (Q) TQuery Event AfterInsert never fired

6. Minimize the Application not just the form?

7. Disappearing forms.oncreate and onclose events

8. Copying buttons between forms -- properties retained but event handler code lost

9. Lost Form OnCreate/ OnClose Events

10. Call an event within another event

11. Is there a way to fire an event by doing this...

12. Please look at my fire code and critique/criticize it... - fire.zip (0/1)

 

 
Powered by phpBB® Forum Software