jahlxx Posted May 3, 2016 Posted May 3, 2016 HI. I have a procedure, that shows a modal form. The app must wait to that form to close, but the execution of the procedure that calls the form, continues execution before the user close the modal form. how can I solve this? thanks. Quote
Sherzod Posted May 3, 2016 Posted May 3, 2016 Hi, Use callback: For example: C:\Program Files (x86)\FMSoft\Framework\uniGUI\Demos\Desktop\Form Callback Best regards. Quote
jahlxx Posted May 3, 2016 Author Posted May 3, 2016 Hi. Don't work. In that sample, If you put : UniForm1.ShowModal(ShowCallBack); UniMemo1.Lines.Add('hello'); UniMemo1.Lines.Add('hello'); UniMemo1.Lines.Add('hello'); UniMemo1.Lines.Add('hello'); UniMemo1.Lines.Add('hello'); You can see that the execution doen't wait until the callback. Quote
Sherzod Posted May 3, 2016 Posted May 3, 2016 Yes of course,You must change the logic and move "the codes" to the Callback function Quote
Administrators Farshad Mohajeri Posted May 3, 2016 Administrators Posted May 3, 2016 is the only way? Currently yes. Quote
jahlxx Posted May 3, 2016 Author Posted May 3, 2016 is a very big problem for me, and I don't know how to solve it. I'm trying to migrate vcl apps to unigui, and I need that the showmodal procedure of a form, wait until the form is closed. I have some parametrized modal forms, that returns some values, but if tha app is still running after the showmodal, is a problem for me. Quote
jahlxx Posted May 4, 2016 Author Posted May 4, 2016 could be a good idea this functionallity in future releases? Quote
jahlxx Posted May 21, 2016 Author Posted May 21, 2016 grgrgrgrgrrggrgrgrgrgrgrgr, I'm still with this problem I don't know how to solve it, because the showmodal doesn't wait to form close. I have a tuniedit.. In key press of some key, a form is displayes with the info of a table and the user select one row, In the close of the form, the value of a field mus be returned, and must be captured for the initial tuniedit. Some help, please. I'm getting crazy. I don't know how to do this. In vls apps, the showmodal waits until the form is closed, but in unigui not. Thanks. Quote
ZigZig Posted May 21, 2016 Posted May 21, 2016 Web frameworks such as ExtJS are asynchronous (the first "A" of "AJAX" means "asynchronous"). So you cannot directly synchronize client actions (such as closing a modal form) and server actions (such as using Delphi code, which runs on server side, to put a specific value in a field). It is not a limitation of uniGUI, it's just the way Web Client-Server applications are. The only way, if you want to synchronize client action (done on a browser) and server reaction (written in Delphi and running on your server), is to use callback procedure. Otherwise, you can write a 100% client procedure (in Javascript) to put the value of your field into your TUniEdit (see Client Events) : this way will by synchronous (because it stays on client side) ! Quote
asapltda Posted May 21, 2016 Posted May 21, 2016 procedure TMainmForm.BTNSHOWLOGINClick(Sender: TObject); begin SHOWLOGIN(); end; procedure TMainmForm.SHOWLOGIN; begin FLOGINMVL.SHOWMODAL( procedure(Sender: TComponent; Result: Integer) var i:Integer; begin // LOGIN OK if Result = mrOk then begin FMENUMVL.SHOWMODAL(procedure(Sender: TComponent; Result: Integer) begin if Result = mrOk then begin end; if Result = mrcancel then begin end; end) end; // LOGIN INVALIDO if Result = mrcancel then begin end; end) end; Quote
jahlxx Posted May 21, 2016 Author Posted May 21, 2016 hi. I understand what you say. but I don't know how to return a value with callback method. Quote
asapltda Posted May 21, 2016 Posted May 21, 2016 procedure TFLOGIN2.UniButton_LOGINClick(Sender: TObject); VAR W_STR:STRING; begin g_usuario:= UpperCase(Trim(usuario.text)); <-- USER CODE g_passw := trim(passW.text); <-- PASSWORD VALUE // VALIDAR USUARIO if d.GET_USUARIO(g_usuario , g_PASSW ) = false then begin <---- D. IS DATAMODULE MSGERROR.Caption := 'GET_USUARIO--Usuario Invalido'; USUARIO.SetFocus; exit; end; CONFIGURACIONPARMS.G_Usuario := g_usuario; UniMainModule.G_USUARIO := g_usuario; <------- MainModule THROUGH SHARE IS THE WAY AS BETWEEN DATA FORMS //showmessage('USUARIO CONECTADO'); ModalResult := mrOk ; end; Quote
asapltda Posted May 21, 2016 Posted May 21, 2016 IN DATAMODULE FUNCTION TD.GET_USUARIO(P_USUARIO, P_PASSW:string; var P_ClientDataSet: TClientDataSet):boolean ; // 20140908 Begin if DATABASE.Connected = false then ShowMessage('SIN CONECCION A LA BASE DE DATOS'); T_SQL:= 'SELECT ACTIVO FROM USRMST WHERE USUARIO= ''%s'' AND PASSW = ''%s'' AND FECVEN >= ''%s'' ' ; T_sql:= format(T_sql, [P_USUARIO, P_PASSW, DATETOSTR(DATE)]); result:= GET_TABLA_GENERICA(T_SQL); end; 1 Quote
asapltda Posted May 21, 2016 Posted May 21, 2016 IN MainModule type TUniMainModule = class(TUniGUIMainModule) private { Private declarations } public G_cono:string; g_cliente:string; g_pedidocliente:string; g_string:string; g_usuario:string; G_RECURSO:string; end; 1 Quote
jahlxx Posted May 22, 2016 Author Posted May 22, 2016 Hi. This solution is not valid for me. I'm trying to do a general lookup form, as I have in vcl app. With the solution offered, I have only solved once, and I have to do with every uniedit field. I can't do a unique lookup form for all the fields in the application. I have tried, and works, but I must repeat the same code for all the fields. One problem I have is that I don't know from wich field I am calling the searh form. Quote
jahlxx Posted May 22, 2016 Author Posted May 22, 2016 I think that if I could know the edit field from the modalform is called, the problem could be solved. Quote
Administrators Farshad Mohajeri Posted May 22, 2016 Administrators Posted May 22, 2016 I don't understand why you need blocking modal forms. You can show a uniGUI modal form, capture the result in callback function and assign it to the Edit field. Quote
ZigZig Posted May 22, 2016 Posted May 22, 2016 I'm trying to do a general lookup form, as I have in vcl app. Unfortunately, as I said before, your wish doesn't meet the standard way client-server apps are made in asynchronous mode. Quote
jahlxx Posted May 22, 2016 Author Posted May 22, 2016 ok. I do as farshad says. But I can't do a general modal form parametrizable. I'll do it with every element one by one. Thanks to all. Quote
jahlxx Posted January 10, 2017 Author Posted January 10, 2017 Hi. Is now, with the newest releases of unigui, the possibility of use the showmodal method like in traditional vcl apps? Thanks. Quote
Administrators Farshad Mohajeri Posted January 11, 2017 Administrators Posted January 11, 2017 Hi. Is now, with the newest releases of unigui, the possibility of use the showmodal method like in traditional vcl apps? Thanks. Yes Quote
jahlxx Posted January 17, 2017 Author Posted January 17, 2017 Ok. Can you tell me how? Any sample? Thanks. Quote
jahlxx Posted January 17, 2017 Author Posted January 17, 2017 Ok. I've got it. I forgot to set EnableSynchronousOperations in MainModule. I don't know what negative consecuences this have for the application, in performance terms. Some explanation about this will be wellcome. Thanks. Quote
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.