Jump to content

I need a hint: Callback


Sistema Fenix

Recommended Posts

Hello Guys!
 
Please give me an example of how Farshad, creates the function will return with callback. 
I tried several ways and can not do as he does, passing the procedure within the call. I need to ride some, but only managed to procedures outside the call, I would call could equal the example below: 
   UniForm1.Show (
     procedure (Result: Integer) 
     begin 
       UniMemo1.Lines.Add ('Form Close:' + IntToStr (Result)); 
     end 
   );

 

 

 

  • Upvote 1
Link to comment
Share on other sites

*** MAIN FORM CALL LOGIN FORM , LOGIN FORM RETURN OK or false
 
procedure TFLOGISTICASOFT.BTN_CONTINUARClick(Sender: TObject);
var
 w_html:string;
 
begin
 w_html:= '<p><strong>Usuario Invalido</strong> </p>' ;
 w_html:= '<p><font face="arial" color="FF0000" size="4"> Usuario Invalido </p>' ;
 
 
 
 MSGERROR.Text:='' ;
 FLOGIN.SHOWMODAL(
   procedure(Result: Integer)
   begin
      if Result = mrOk then begin
         FMENU.SHOWMODAL(
         procedure(result:integer)
         begin
         end )
      end;
      if Result = mrcancel then
          MSGERROR.Text:=  w_html;
 
          //MSGERROR.Text:= 'mrCancel';
   end )
end;

 

 

// *** LOGIN FORM  BUTON LOGIN

 

procedure TFLOGIN.UniButton1Click(Sender: TObject);
begin
if uppercase(CodigoImagen.Text) <> G_CAPTCHA then begin
   MSGERROR.Caption := 'Codigo Imagen Invalido';
   CodigoImagen.SetFocus;
   exit;
end;
 
 
if  d.GET_USUARIO(usuario.Text , PASSW.text) = false then  begin
   MSGERROR.Caption := 'Usuario Invalido';
   USUARIO.SetFocus;
   exit;
end;
 
 
  ModalResult := mrOk  ;
end;

 

******** // *** LOGIN FORM  BUTON CANCEL

procedure TFLOGIN.UniButton_CANCELARClick(Sender: TObject);
begin
  ModalResult := mrCancel ;
end;
 

 

Link to comment
Share on other sites

  • 2 months later...
Hi Farshad.
Hi perjanbr.
 
Thank you for your answers! 
 
Sorry, but I understood the question Fenix otherwise ... ​​, 
ie how to create a custom user-defined function with callback? 
Is it possible? 
 
for example: 
 
after the completion of a certain function, the function calls another callback function.
 
Sorry if I was not able to to explain the essence of my question, and if the question is not correct...

 

 
Sincerely.

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...