Jump to content

anonimous callback


AntonioCuomo

Recommended Posts

j have these code:

procedure TUniForm_RapportiLavoro.UniSpeedButton3Click(Sender: TObject);
begin
if ABSTRapporti.State in dseditmodes then
           begin
             MessageDlg('Salva Rapporto di Lavoro', mtConfirmation, mbYesNo,
                  procedure(Sender: TComponent; Res: Integer)
                  begin
                         case Res of
                              mrYes : abstrapporti.post;
                              mrNo : abstrapporti.cancel;
                            end;
                   end);
           end;
ABSTRapporti.Close;
close;
end;

 

The dialog of messagge is open after then close of form Rapporti and the code of anonimous procedure not execute.

v. of unigui is 1.90.0.1506

 

Link to comment
Share on other sites

j have resolve:

 

if ABSTRapporti.State in dseditmodes then
           begin
             MessageDlg('Salva Rapporto di Lavoro', mtConfirmation, mbYesNo,
                  procedure(Sender: TComponent; Res: Integer)
                  begin
                         case Res of
                              mrYes : begin
                                      abstrapporti.post;
                                      ABSTRapporti.Close;
                                      close;
                                      end;

                              mrNo : begin
                                      abstrapporti.cancel;
                                      ABSTRapporti.Close;
                                      close;
                                      end;
                            end;
                   end);

           end;

 

but not is elegant and correct

Link to comment
Share on other sites

  • 2 weeks 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...