The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Using "X" doesn't invoke AXFormCloseQuery(Sender)
Posted: 20 Oct 07 8:32 AM
|
I have a form with required fields that I use AXFormCloseQuery(Sender) to prevent the user from closing the form without them.
The problem is they can click the close form "X" in the upper right hand corner and this bypasses the AXFormCloseQuery(Sender) code. I've tried
Sub AXFormClose(Sender) AXFormCloseQuery(Sender) End Sub
But the form still closes. Is there a way to hide the Window "X" button or another way to fix this problem?
This is SLX 6.2. Thanks.
|
|
|
|
Re: Using "X" doesn't invoke AXFormCloseQuery(Sender)
Posted: 20 Oct 07 8:49 AM
|
Maybe this is a bug? I just tried this last week in version 7.0.1 and it worked fine. The form's OnCloseQuery event did fire when the form was attempted to be closed by clicking the X on the title bar.
I'll see if I can reproduce on a 6.2 system... |
|
|
| |
|
Re: Using "X" doesn't invoke AXFormCloseQuery(Sender)
Posted: 20 Oct 07 10:22 AM
|
Thanks for the quick response.
'code below works fine when hitting "OK" but not when clicking on the "X" Included msgbox "TEST" just to see if it would show when hitting "X" and it doesn't.
Function AXFormCloseQuery(Sender)
msgbox "TEST"
If (txtAddress1.text="" OR pklCity.text="" OR pklState.text="" OR txtDestSQFT.text="" OR _ cboComQuarter.text="" OR txtComYear.text="") AND pklReason.text="Signed Lease" Then
MsgBox "Address 1, City, State, Destination SQFT, Committment Date and Reason are ALL required fields."
AXFormCloseQuery = False ElseIf pklReason.text="" Then MsgBox "Reason is a required field." AXFormCloseQuery = False Else If txtMode.Text="Account" Then If pklReason.text="Signed Lease" Then SaveLeaseSigned Else SaveOther End IF End If
InsertNote AXFormCloseQuery = True Application.BasicFunctions.RefreshMainView End If End Function
|
|
|
| |
|
Re: Using "X" doesn't invoke AXFormCloseQuery(Sender)
Posted: 20 Oct 07 11:37 AM
|
Hi Michael,
I tested with both a data form and a manage form and both worked for me. Are you saying that when you click the X you don't even get the Test MsgBox?
I tested with v6.2.6 - what version of 6.2 are you on? |
|
|
|
Re: Using "X" doesn't invoke AXFormCloseQuery(Sender)
Posted: 20 Oct 07 1:04 PM
|
Yeah, I'm on 6.2.6 as well.
Yes, I don't even get the Test MsgBox when I click the X.
How are you creating the form? Maybe that's the difference.
I'm using:
Set objMainView = Application.MainViews.Add("System:JUNKTEST", 0, False) objMainView.ShowModal |
|
|
|
Re: Using "X" doesn't invoke AXFormCloseQuery(Sender)
Posted: 20 Oct 07 9:31 PM
|
Well, that would have to be the difference. In my tests I was launching the form using DoInvoke, not launching it as a MainView. My guess is that yours will work as well if you are able to load it using DoInvoke. |
|
|
|
Re: Using "X" doesn't invoke AXFormCloseQuery(Sender)
Posted: 24 Oct 07 7:39 AM
|
Ryan, thanks again for helping me out.
Launching the form as a MainView does indeed disable the OnCloseQuery functionality. I changed the code to use ShowViewForRecordEx and the problem is solved. |
|
|
| |
|