Hello, I work with Delphi and I am new to UniGui, I ask for your help to know the best way to carry out this implementation. I have 2 forms, FormA and FormB. All 2 are created at the same time. FormA calls a function that is located in FormB, and with the value it returns it does another process:
FormA Code:
procedure TFrameDiagnosticos.UniBitBtn1Click(Sender: TObject);
var
idDx : Integer;
begin
idDx := frmbuscadorgenerico1.buscadorgenerico1('CIE9_DETRIPS', 'ID_CIE9', 'COD_CIE9', 'DES_CIE9');
DmDiagnosticos.abrir_diagnostico(0, idDx);
UniEdit1.Text := DmDiagnosticos.q_DxPpal.FieldByName('Cod_Cie9').AsString;
end;
FormB Code:
function Tfrmbuscadorgenerico1.buscadorgenerico1(const tabla, id, codigo, descripcion: string): integer;
begin
UniDBGrid1.Columns[0].FieldName := codigo;
UniDBGrid1.Columns[1].FieldName := descripcion;
UniQuery1.Close;
UniQuery1.SQL.Clear;
UniQuery1.SQL.Add(Format('Select %s, %s, %s From %s Where %s||%s ',
[id,
codigo,
descripcion,
tabla,
codigo,
descripcion]));
UniQuery1.SQL.Add('');
frmbuscadorgenerico1.ShowModalN;
if UniQuery1.IsEmpty then
result := -1
else
Result := UniQuery1.Fields[0].AsInteger;
end;
If I use this same code in Delphi without Unigui, when I call the function of form2, form2 is displayed, and when it is closed it returns a value. This same code in UniGui works differently, it's called the function but the program goes on and the variable I need never has a valid value. Thanks a lot.