Jump to content

I need a hint: Callback


Sistema Fenix
 Share

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

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.

 Share

×
×
  • Create New...