Advertisement
antonydanby

GetYesNoConfirmationProc

Apr 18th, 2023 (edited)
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.41 KB | Source Code | 0 0
  1. procedure TMainForm.GetYesNoConfirmationProc(aMessage: string; aProc: TInputCloseDialogProc);
  2. begin
  3.   TDialogService.PreferredMode := TDialogService.TPreferredMode.Platform;
  4.   TDialogService.MessageDialog(aMessage,
  5.     TMsgDlgType.mtConfirmation,
  6.     [ TMsgDlgBtn.mbOK, TMsgDlgBtn.mbCancel ],
  7.     TMsgDlgBtn.mbOK, 0,
  8.     aProc );
  9. end;
  10.  
  11. // Example usage:
  12.  
  13. procedure TMainForm.ListViewOrderDetailsDoupleTap(const AItem: TListViewItem);
  14. begin
  15.   var txtQty: TListItemText := TListItemText(AItem.View.FindDrawable('txtQty'));
  16.   var txtSku: TListItemText := TListItemText(AItem.View.FindDrawable('txtSku'));
  17.   var aConfirm: string := format('Please confirm that you wish to submit the following SKU: %s',[txtSku.Text]);
  18.  
  19.   var aProc: TInputCloseDialogProc :=
  20.  
  21.       procedure(const AResult: TModalResult)
  22.       begin
  23.         if AResult = mrOk then
  24.         begin
  25.           var canScan: boolean := true;
  26.           var dividerPos: integer := Pos('/',txtQty.Text);
  27.           var amountPickedValue: string := Copy(txtQty.Text,dividerPos+1).Trim;
  28.  
  29.           if ((dividerPos > 0) and (amountPickedValue.Contains('--'))) then
  30.           begin
  31.             var aValue: string := txtSku.Text;
  32.             VerifyQuantity(aValue);
  33.             canScan := false;
  34.           end;
  35.           if canScan then RequestScan(fSession.User,GetStringPage,txtSku.Text);
  36.         end;
  37.       end;
  38.  
  39.   GetYesNoConfirmationProc(aConfirm,aProc);
  40. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement