Jump to content

Whats the best way to stop a form closing (UNIGUI Web that is)....


Guest

Recommended Posts

Message from: "Andrew Tierney"

 

I have the following code:

 

procedure TUniForm1.UniFormClose(Sender: TObject; var Action: TCloseAction);

begin

if (UniMainModule.dsVOR.DataSet.State = dsEdit) or

(UniMainModule.dsVOR.DataSet.State = dsInsert) then

begin

MessageDlg('Save changes before closing?', mtConfirmation,

mbYesNo,_Confirm);

end;

end;

 

But the form disappears before the MessageDlg is display, then a runtime

error occurs when I try to access the form which has disappeared. (Again

different behavior to the Windows version of the UniGui app).

 

Even if this didn't happen, I gather I need to somehow callback to

UniFormClose to set the CloseAction = caNone ???

 

Any info greatly appreciated.

 

Andrew

.

 

Link to comment
Share on other sites

Message from: "Javi"

 

Hi....

 

In web mode. A modal window, never block the execution of the event. I think.

 

For example:

 

procedure TUniForm1.UniFormClose(Sender: TObject; var Action: TCloseAction);

begin

if (UniMainModule.dsVOR.DataSet.State = dsEdit) or

(UniMainModule.dsVOR.DataSet.State = dsInsert) then

begin

MessageDlg('Save changes before closing?', mtConfirmation, mbYesNo,_Confirm); <<== This doesn't stop.

end;

end;

 

You put a breakpoint on this line =>MessageDlg and you run this application in web mode.

 

 

I think than you can do other this:

 

procedure TUniForm1.UniFormClose(Sender: TObject; var Action: TCloseAction);

begin

if (UniMainModule.dsVOR.DataSet.State = dsEdit) or

(UniMainModule.dsVOR.DataSet.State = dsInsert) then

begin

CloseAction = caNone;

MessageDlg('Save changes before closing?', mtConfirmation, mbYesNo,_Confirm);

end;

end;

 

But wait Farshad answer you, if I'm wrong.

 

--

NNTP.hk - (^(oo)^)

http://www.nntp.hk/web/

 

.

 

Link to comment
Share on other sites

Message from: "Farshad Mohajeri"

 

You may try these steps:

 

-Make BorderStyle = bs Dialog

-In BorderIcons biSystemMenu = False (So user can't close the Form from

upper right corner)

-In OnClose event set CloseAction := caNone unless user is allowed to close

the form.

 

"Andrew Tierney" wrote in message

news:yS%23qMzssLHA.2084@anaxagvs227...

>I have the following code:

>

> procedure TUniForm1.UniFormClose(Sender: TObject; var Action:

> TCloseAction);

> begin

> if (UniMainModule.dsVOR.DataSet.State = dsEdit) or

> (UniMainModule.dsVOR.DataSet.State = dsInsert) then

> begin

> MessageDlg('Save changes before closing?', mtConfirmation,

> mbYesNo,_Confirm);

> end;

> end;

>

> But the form disappears before the MessageDlg is display, then a runtime

> error occurs when I try to access the form which has disappeared. (Again

> different behavior to the Windows version of the UniGui app).

>

> Even if this didn't happen, I gather I need to somehow callback to

> UniFormClose to set the CloseAction = caNone ???

>

> Any info greatly appreciated.

>

> Andrew

 

 

.

 

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...