Hi,
First i expose my situation:
- I have a form. Main form. In it, i have a Menu with various options. Every option open a newform inside a TWebPanel that i use like a container.
- Every "subforms" retrieve data from a REST Server using TWebClientConnection, TWebClientDataset and TWebDatasource from send data to controls dbaware...
- This connection for retrieve data from REST Server is make in the procedure AfterCreate. I write this procedure into a master form. See the code:
procedure TfMmain.tbbFICH_ProductosClick(Sender: TObject);
var
fUproducto: TfMproducto;
//Crida a initForm del formulari que creem
procedure AfterCreate(AForm: TObject);
var
paramsIN: TparsMproductoIN;
begin
// Aqui assignacio de calors de paramsIN
fUproducto.InitForm(paramsIN);
end;
begin
// CONTAINER es el IdElement del panell que contindra els formularis que s'obren
fUproducto:=TfMproducto.CreateNew('CONTAINER',@AfterCreate);
fUproducto.ShowModal;
end;
Note that fUproducto is the newform, and in this form i write the function: initForm().
In that function (initForm), located in fUproducto, i retrieve the data.
When i only retrieve data from one REST Server Method all runs fine...
But when i retrieve information of more than ones REST Server Method the error appear in the moment of i try to retrieve the second method. When i set to active the TWebClientConnection.
For your information: The first time i call a data that is the list of registers of "customers" (For example). The TWebDataSource provides data to TWebDBGrid and TWebDBEdits, DBNavigator,...
In the customer register there are fields that i want the user to select using a TWebDBLookupoComboBox...
Then the second and third Method that i call from REST Server provides me of the TWebClientDataSet for this TWebDBLookupCombobox....
When i try to call second method to retrieve data, the browser send a error indicating that can not find a REST Server Method (URI).
But if i disconnect this calls (Only maintain the first), all runs fine. Then i call this three methods usint a OnClick Event of one TWebButton (Not in the function that i call in the AfterCreate) and then all runs fine too...
I think that there are a conceptual problem calling various REST Server Methods in AferCreate, and this is not a good practice but i do not know which is the best practice to do this.
Can you help me ?
Thanks ?