Jump to content

app execution


jahlxx

Recommended Posts

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.

 

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 weeks later...

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.

Link to comment
Share on other sites

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) !

Link to comment
Share on other sites

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;
Link to comment
Share on other sites

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;

Link to comment
Share on other sites

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;
  • Upvote 1
Link to comment
Share on other sites

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;
  • Upvote 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 7 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...