From Clomosy Docs

(Created page with "The "AskAndCall" function is commonly used in Clomosy programming to display a dialog box where you can request user confirmation. It has a structure similar to the "Ask" function. You can use this function to ask a question or present options to the user. Clomosy.AskAndCall('Do you like Clomosy?','ProcYesOnClick','ProcNoOnClick'); The "AskAndCall" function takes three parameters. The first parameter represents the question or prompt displayed in the dialog...")
 
No edit summary
Line 6: Line 6:


'''Example:'''<br>
'''Example:'''<br>
:'''Base Syntax'''
  var
  var
   MyForm:TCLForm;
   MyForm:TCLForm;
Line 35: Line 36:
   MyForm.Run;
   MyForm.Run;
  end;
  end;
:'''TRObject Syntax'''
  var
    MyForm:TCLForm;
    askAndCallBtn:TCLButton;
  void ProcYes;
  {
    ShowMessage('Yes Clicked');
  }
  void ProcNo;
  {
    ShowMessage('No Clicked');
  }
  void askAndCallBtnOnClick;
  {
    Clomosy.AskAndCall('Do you like Clomosy?','ProcYes','ProcNo');
  }
 
  {
    MyForm = TCLForm.Create(Self);
   
    askAndCallBtn= MyForm.AddNewButton(MyForm,'askAndCallBtn','AskAndCall Function');
    askAndCallBtn.Align=alTop;
    askAndCallBtn.Margins.Top=20;
    askAndCallBtn.Margins.Right=20;
    askAndCallBtn.Margins.Left=20;
    askAndCallBtn.Margins.Bottom=20;
    MyForm.AddNewEvent(askAndCallBtn,tbeOnClick,'askAndCallBtnOnClick');
   
    MyForm.Run;
  }

Revision as of 14:11, 6 February 2024

The "AskAndCall" function is commonly used in Clomosy programming to display a dialog box where you can request user confirmation. It has a structure similar to the "Ask" function. You can use this function to ask a question or present options to the user.

Clomosy.AskAndCall('Do you like Clomosy?','ProcYesOnClick','ProcNoOnClick');

The "AskAndCall" function takes three parameters. The first parameter represents the question or prompt displayed in the dialog box. The second parameter specifies the action to be taken if the confirmation button is clicked. If the rejection button is clicked, the function will proceed to the action specified in the third parameter.

Example:

Base Syntax
var
 MyForm:TCLForm;
 askAndCallBtn:TCLButton;
 procedure ProcYes;
 begin
   ShowMessage('Yes Clicked');
 end;
 procedure ProcNo;
 begin
   ShowMessage('No Clicked');
 end;
procedure askAndCallBtnOnClick;
 begin
   Clomosy.AskAndCall('Do you like Clomosy?','ProcYes','ProcNo');
 end;

begin
 MyForm := TCLForm.Create(Self);

 askAndCallBtn:= MyForm.AddNewButton(MyForm,'askAndCallBtn','AskAndCall Function');
 askAndCallBtn.Align:=alTop;
 askAndCallBtn.Margins.Top:=20;
 askAndCallBtn.Margins.Right:=20;
 askAndCallBtn.Margins.Left:=20;
 askAndCallBtn.Margins.Bottom:=20;
 MyForm.AddNewEvent(askAndCallBtn,tbeOnClick,'askAndCallBtnOnClick');

 MyForm.Run;
end;
TRObject Syntax
 var
   MyForm:TCLForm;
   askAndCallBtn:TCLButton;
 void ProcYes;
 {
   ShowMessage('Yes Clicked');
 }
 void ProcNo;
 {
   ShowMessage('No Clicked');
 }
 void askAndCallBtnOnClick;
 {
   Clomosy.AskAndCall('Do you like Clomosy?','ProcYes','ProcNo');
 }
 
 {
   MyForm = TCLForm.Create(Self);
   
   askAndCallBtn= MyForm.AddNewButton(MyForm,'askAndCallBtn','AskAndCall Function');
   askAndCallBtn.Align=alTop;
   askAndCallBtn.Margins.Top=20;
   askAndCallBtn.Margins.Right=20;
   askAndCallBtn.Margins.Left=20;
   askAndCallBtn.Margins.Bottom=20;
   MyForm.AddNewEvent(askAndCallBtn,tbeOnClick,'askAndCallBtnOnClick');
   
   MyForm.Run;
 }