Jump to content

MessageBox function is not running on server (web mode)


dynamo

Recommended Posts

MessageBox function is running on localhost but not running on server.

 

or Can I use a useful function rather than MessageBox ,so it have to run without problem on DESKTOP and WEB.

 

procedure TuniForm4.UniBitBtn4Click(Sender: TObject);
begin
if MessageBox(0,'Are you delete this record...?','WARNING',MB_YESNO)=ID_NO then exit;

///------------

//-------------

end;

 

this code under WEB MODE

http://localhost:8077/ ---> is running

 

http://server:8077/ ---> is not running and gives the following error (attach file):

Link to comment
Share on other sites

MessageDlg is running on DESKTOP but is not running on WEB.You can test sample Dialogs:

 

uniButton5 ->Confirm:

 

 

procedure TMainForm.DCallBack2(Res: Integer);

begin

case Res of

mrYes : UniEdit1.Text:='YES';// UniMemo1.Lines.Add('YES');

mrNo : UniEdit1.Text:='NO';//UniMemo1.Lines.Add('NO');

end;

end;

 

procedure TMainForm.UniButton5Click(Sender: TObject);

begin

caption:=''; UniEdit1.Clear;

MessageDlg('Dialog2', mtConfirmation, mbYesNo, DCallBack2);

 

if UniEdit1.Text='YES' then begin

 

caption:='aaa';

end;

end;

Link to comment
Share on other sites

For Delphi 2009+ you can use anonymous method (closure):

 

MessageDlg('Are you delete this record?', mtConfirmation, mbYesNo,
 procedure(AResult: Integer)
 begin
   case AResult of
     mrYes: UniEdit1.Text := 'YES'; // UniMemo1.Lines.Add('YES');
     mrNo : UniEdit1.Text := 'NO';  // UniMemo1.Lines.Add('NO');
   end;
 end);

Link to comment
Share on other sites

thanks.Using MessageDlg ,UniEdit1.Text gets value of "YES" or "NO" but I have a problem this: (on WEB MODE)

 

Look at the following code:

 

procedure TMainForm.UniBitBtn1Click(Sender: TObject);
begin
 //--------is running-----------------------------
 MainForm.caption:='';   UniEdit1.Clear;

 MessageDlg('Are you delete this record?', mtConfirmation, mbYesNo,
 procedure(AResult: Integer)
 begin
   case AResult of
     mrYes: UniEdit1.Text := 'YES';
     mrNo : UniEdit1.Text := 'NO';
   end;
 end);
 //---------------------------------------------


 //--------------is not running------??????????????????????
 if UniEdit1.Text='YES' then   begin
     MainForm.caption:='aaa';
 end;
 //----------------------------------??????????????????????
end;

post-465-0-92562000-1346393176.png

Link to comment
Share on other sites

Hello,

 

In webmode there is no pause, the execution is already done/passed for the code you say '..is not running..'

 

Simply, may take required action in first dialogs callback procedure...

 


procedure TMainForm.UniBitBtn1Click(Sender: TObject);
begin
 //--------is running-----------------------------
 MainForm.caption:='';   UniEdit1.Clear;

 MessageDlg('Are you delete this record?', mtConfirmation, mbYesNo,
 procedure(AResult: Integer)
 begin
   case AResult of
     mrYes: DELETE...;
     mrNo : SKIP...;
   end;
 end);

 //--------------is not running------!!!   ALREADY PASSED
 if UniEdit1.Text='YES' then   begin
     MainForm.caption:='aaa';
 end;

end;

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.

×
×
  • Create New...