jocemora75 Posted January 31 Share Posted January 31 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. Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted February 1 Share Posted February 1 Hello Jocemora, In web development, you have to think differently : 1. You have to separate your business logic (code) from your design (forms). Instead of using functions located on forms, create an unit ( UniDataModule), where you will put all your common code. (Better use class objects inside this unit). 2. For showModal, see : https://www.unigui.com/doc/online_help/synch-and-asynch-operations.htm 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.