If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Delphi - dbExpress - MySQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-11-02, 17:32
Gizmo Gizmo is offline
Registered User
 
Join Date: Dec 2002
Location: KeeBee
Posts: 1
Arrow Delphi - dbExpress - MySQL

Hi all,

I've developed a little app. using MySQL via dbExpress, that contains the following objects:
- datamodule (with Tsqlconnection, TSQLDataSet, TDataSetProvider and a TClientDataSet),
- form (with a pagecontrol - two tabs: overview and detail), button 'Insert', action (DataSetInsert) and a TDataSource.

The tab 'Overview' contains a dbgrid (readonly := true) that's filled with all the records of a table. The tab 'Detail' contains two dbEdits.
The button has one action connected to it. And that's a DataSetInsert (a built-in action of Delphi).

When I scroll (by mouse or keys) through the dbgrid and hit the button, it activates the Detail-tab and inserts a new blank record. So far so good. Everything just works fine.

Now when I add a toolbar to the form, add a button (TToolButton) on the bar and connect the action DataSetInsert to the toolbutton, the app won't work when I want to insert a new record after I've been scrolling through the grid.

The app does a Insert, immediately followed by a Browse.

When going into Insert is handled by the OnStateChange of the TDataSource (which is connected to the TClientDataSet on the datamodule). The event only contains the following code:

if dtsMain.State in [dsInsert] then begin
pagecontrol1.ActivePageIndex := 1;
dbedit1.SetFocus;
end;

The OnNewRecord-event of the ClientDataSet only contains code to get the highest number, add 1 to it and put it in a field of the clientdataset.

REMARK: all of this code works when using the TButton to insert a record. When using the button on the toolbar, it gives the following error: DataSet not in Edit or Insert mode.

The problem not only arises by using TToolbar, it also happens when using the ActionBar (TActionManager).

Anyone an idea of what's going wrong?


Thnx in advance.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On