Subject | Re: TIB_LOOKUPCOMPO |
---|---|
Author | hadji@logos.cy.net |
Post date | 2001-08-18T15:28:06Z |
Thank you all for the answers.To undestand better my problem see
below
My project has 4 forms.The main form,the data module,the projects
detail form and the projects type form.The last two forms contain
each one IB_GRID and several IB_EDIT controls.
The data module contains the following.
1.TIB_QUERY(qrCONCUST) for the projects table(concust) with SQL as
below
'select * from concust'
2.TIB_QUERY (qrPROCATEGORIES)for the project types table(protypes)
with SQL as below
'select * from protypes'
3.Two TIB_DATASOURCES(dsCONCUST,qryPROCATEGORIES) connected to above
4.One TIB_CONNECTION(cnCRAMS) pointing to the database.
5.One TIB_TRANSACTION(tsCRAMS).
TIB_QUERIES ib_connections are set to cnCRAMS and ib_transactions
to tsCRAMS.
On the projects form i have buttons for editing the data and adding
data.
eg. the code for the ADD button is
DATA.qryCONCUST.Insert;
BTOK.Visible:=TRUE;
BTCANC.VISIBLE:=TRUE;
BTOK,BTCANC buttons are for commiting the changes of insert or
discarting them
The code for the BTOK button is
IF (IB_EDIT1.Text='') OR (LENGTH(IB_EDIT1.Text)<5) THEN
BEGIN
SHOWMESSAGE('WRONG CODE!!');
EXIT;
END;
DATA.qryCONCUST.Post;
DATA.tsCRAMS.Commit;
DATA.qryCONCUST.CLOSE;
DATA.qryCONCUST.OPEN;
BTOK.Visible:=FALSE;
BTCANC.VISIBLE:=FALSE;
The code for the BTCANC button is
DATA.qryCONCUST.Cancel;
DATA.tsCRAMS.Rollback;
DATA.qryCONCUST.CLOSE;
DATA.qryCONCUST.OPEN;
BTOK.Visible:=FALSE;
BTCANC.VISIBLE:=FALSE;
Similar controls and buttons exist for the projecttypes form
Everything works ok upto now.
When in the projects form i drop a TIB_LOOKUPCOMBO and set it up
my problems start.
Settings for the tib_lookupcombo
datasource : dsPROTYPES
custompopup :ib_grid2 (pointing to dsPROCATEGORIES)
Displayfield:Category (primary key in PROTYPES)
Settings for the qryPROCATEGORIES
keylinks - PROTYPES.CATEGORY=CONCUST.KIND
Keysource- dsCONCUST
When i run the programme (queries open in the oncreate of the
datamodule) the lookupcombo works ok.
When i click the button BTPROTYPES the projecttypes form is opened.
In this form when i try to scroll the grid i get a message that
'dataset cannot scroll'.The data in this table is located to the
category that the projects data was on when the projectstype form
was called. When i try to edit this record(the only one i can edit
since dataset cannot be scrolled) the projects table is also
set in edit mode and i undestand this from the colors since they
change when in different modes.The same happens if i try to add a
record in the PROTYPES table.
After i post the changes of the edits or insert then i can scroll the
grid.
The state of the projects file remains in edit mode.
The other thing that is happening is that the field of a projects
data in this case 'KIND' changes value as i scroll the PROTYPES
in the grid.Is this normal.
The code for saving the changes or inserts in the PROTYPES table
is
IF (IB_EDIT1.Text='') OR (LENGTH(IB_EDIT1.Text)<2) THEN
BEGIN
SHOWMESSAGE('WRONG CODE!!');
EXIT;
END;
DATA.qryPROCATEGORIES.Post;
DATA.tsCRAMS.Commit;
DATA.qryPROCATEGORIES.CLOSE;
DATA.qryPROCATEGORIES.OPEN;
BTOK.Visible:=FALSE;
BTCANC.VISIBLE:=FALSE;
Please tell what Iam doing wrong.I am new to programming c/s.
Thanks
Costas
below
My project has 4 forms.The main form,the data module,the projects
detail form and the projects type form.The last two forms contain
each one IB_GRID and several IB_EDIT controls.
The data module contains the following.
1.TIB_QUERY(qrCONCUST) for the projects table(concust) with SQL as
below
'select * from concust'
2.TIB_QUERY (qrPROCATEGORIES)for the project types table(protypes)
with SQL as below
'select * from protypes'
3.Two TIB_DATASOURCES(dsCONCUST,qryPROCATEGORIES) connected to above
4.One TIB_CONNECTION(cnCRAMS) pointing to the database.
5.One TIB_TRANSACTION(tsCRAMS).
TIB_QUERIES ib_connections are set to cnCRAMS and ib_transactions
to tsCRAMS.
On the projects form i have buttons for editing the data and adding
data.
eg. the code for the ADD button is
DATA.qryCONCUST.Insert;
BTOK.Visible:=TRUE;
BTCANC.VISIBLE:=TRUE;
BTOK,BTCANC buttons are for commiting the changes of insert or
discarting them
The code for the BTOK button is
IF (IB_EDIT1.Text='') OR (LENGTH(IB_EDIT1.Text)<5) THEN
BEGIN
SHOWMESSAGE('WRONG CODE!!');
EXIT;
END;
DATA.qryCONCUST.Post;
DATA.tsCRAMS.Commit;
DATA.qryCONCUST.CLOSE;
DATA.qryCONCUST.OPEN;
BTOK.Visible:=FALSE;
BTCANC.VISIBLE:=FALSE;
The code for the BTCANC button is
DATA.qryCONCUST.Cancel;
DATA.tsCRAMS.Rollback;
DATA.qryCONCUST.CLOSE;
DATA.qryCONCUST.OPEN;
BTOK.Visible:=FALSE;
BTCANC.VISIBLE:=FALSE;
Similar controls and buttons exist for the projecttypes form
Everything works ok upto now.
When in the projects form i drop a TIB_LOOKUPCOMBO and set it up
my problems start.
Settings for the tib_lookupcombo
datasource : dsPROTYPES
custompopup :ib_grid2 (pointing to dsPROCATEGORIES)
Displayfield:Category (primary key in PROTYPES)
Settings for the qryPROCATEGORIES
keylinks - PROTYPES.CATEGORY=CONCUST.KIND
Keysource- dsCONCUST
When i run the programme (queries open in the oncreate of the
datamodule) the lookupcombo works ok.
When i click the button BTPROTYPES the projecttypes form is opened.
In this form when i try to scroll the grid i get a message that
'dataset cannot scroll'.The data in this table is located to the
category that the projects data was on when the projectstype form
was called. When i try to edit this record(the only one i can edit
since dataset cannot be scrolled) the projects table is also
set in edit mode and i undestand this from the colors since they
change when in different modes.The same happens if i try to add a
record in the PROTYPES table.
After i post the changes of the edits or insert then i can scroll the
grid.
The state of the projects file remains in edit mode.
The other thing that is happening is that the field of a projects
data in this case 'KIND' changes value as i scroll the PROTYPES
in the grid.Is this normal.
The code for saving the changes or inserts in the PROTYPES table
is
IF (IB_EDIT1.Text='') OR (LENGTH(IB_EDIT1.Text)<2) THEN
BEGIN
SHOWMESSAGE('WRONG CODE!!');
EXIT;
END;
DATA.qryPROCATEGORIES.Post;
DATA.tsCRAMS.Commit;
DATA.qryPROCATEGORIES.CLOSE;
DATA.qryPROCATEGORIES.OPEN;
BTOK.Visible:=FALSE;
BTCANC.VISIBLE:=FALSE;
Please tell what Iam doing wrong.I am new to programming c/s.
Thanks
Costas