dynamo Posted August 30, 2012 Posted August 30, 2012 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): Quote
dynamo Posted August 30, 2012 Author Posted August 30, 2012 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; Quote
tzal Posted August 30, 2012 Posted August 30, 2012 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); Quote
dynamo Posted August 31, 2012 Author Posted August 31, 2012 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; Quote
Ronak Posted August 31, 2012 Posted August 31, 2012 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; Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.