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!
|
|
Open a modeless form
Posted: 30 Jul 07 10:11 PM
|
I have a client who is asking to have a modeless form display some historical information. This form would remain open, while allowing normal access to the rest of the salesLogix application. I think I have tried each of the options with the various methods of opening a form, whether with DoInvoke or using main views. In each case, the form is modal.
Is this something that needs to be developed in using an external application?
Thanks,
Tom Kaiser |
|
|
|
Re: Open a modeless form
Posted: 30 Jul 07 10:17 PM
|
You can do it as long as you launch the form as a MainView.
Something like this (not tested code)
Dim mv Set mv = Application.MainViews.Add("System:MyForm", 2, False) mv.Show
The key to the code is the "2", which is for mvsStayOnTop and the call to "Show" instead of "ShowModal". |
|
|
|
Re: Open a modeless form
Posted: 30 Jul 07 10:40 PM
|
Ryan,
Thanks for the quick response. I was able to open the form, and indeed it is modeless. However, now it appears that the only way to close the form is to click the X in the top Right window.
I am using salesLogix 7.0.1
I have tried deleting the buttons on the managed form and adding a new button, with the modalResult mrNone, kind = bkCustom. I have tried each of these commands in the code for the button with no success. 'Form.ModalResult = mrOK 'Application.BasicFunctions.CloseCurrentView False 'ModalResult = mrOK
Are there any special procedures to allow the form to close with code?
Thanks,
Tom Kaiser |
|
|
|
Re: Open a modeless form
Posted: 30 Jul 07 11:54 PM
|
Try setting the modal result of the button to mrOK. Then no code should be required - just clicking on this button should close the form. |
|
|
|
Re: Open a modeless form
Posted: 31 Jul 07 7:27 AM
|
I have tried setting the ModalResult of the button to mrOK and the form does not close. With the ModalResult set to mrOK, I have changed the Kind property from bkOK to bkCustom. Still, form does not close.
Thanks,
Tom |
|
|
|
Re: Open a modeless form
Posted: 31 Jul 07 9:57 AM
|
Hi Tom,
Hope this isn't too basic, but the above advice is spot on... Have you double checked that the script (to reset the modalResult = mrOK) is tied to the OK button Onclick event? In SLX, you have to manually hook your script to your control. (On the control's Properties | Events tab).
c |
|
|
|
Re: Open a modeless form
Posted: 31 Jul 07 11:05 AM
|
Carla,
Thanks for your response. Did you notice that my question is about modeless manage form in SalesLogix 7.0.1?
I can use any of the above for a modal form which is displayed using ShowModal or DoInvoke. However for this modeless form, non of these have any affect: Button properties: ModalResult (mrNone, mrOK, mrCancel) Kind (bkCustom, bkCancel, bkOK) Cancel (checked or not checked)
On the button click event handler:
Form.ModalResult = mrOK Application.BasicFunctions.CloseCurrentView False ModalResult = mrOK
Still wondering if X is the only way out.
Thanks,
Tom |
|
|
|
Re: Open a modeless form
Posted: 31 Jul 07 11:24 AM
|
Hi Tom,
I know I've closed modeless MainViews before by setting the ModalResult to mrOK. Not sure why it isn't working for you. You could always try using the ActiveView reference to see if that works:
Application.MainViews.ActiveView.Close
If that doesn't do it, here's one way that will work for sure. You can pass a reference of the MainView object itself to the MainView. Then you can just call it's close method to close the form. Here's how you will do that.
In the MainView, add the following OUTSIDE of any Sub. Just at the top of the script somewhere. You want this to be global in scope to the form so it can't be in any subs of functions.
Dim MainViewReference
Now in the code that invokes the MainView, you'll do this:
Dim mv Set mv = Application.MainViews.Add("System:MyForm", 2, False) Set mv.DetailsView.Script.MainViewReference = mv mv.Show
In the MainView, the variable MainViewReference will contain a reference to the MainView object itself that you created to launch the form. You can use that now when you want to close the MainView by calling it's close method:
' close the main view... MainViewReference.Close
Does all that make sense? |
|
|
|
Re: Open a modeless form
Posted: 31 Jul 07 12:09 PM
|
Ryan,
Thanks for the response. Interesting methods.
Both methods close the Account Details main view. (The button to launch the modeless view is on an Account Tab.)
I suspect it is a matter of changing the reference so that the modeless form closes rather than the Account Details Main view.
Thanks,
Tom |
|
|
|
Re: Open a modeless form
Posted: 31 Jul 07 12:46 PM
|
Oops...
The second method works exactly as Ryan described. (I had misplaced a line of code.)
(The first method still closes the Account Details Mainview).
Thank everyone for your responses!
Tom Kaiser |
|
|
|
Re: Open a modeless form
Posted: 08 Aug 07 7:54 AM
|
Carla,
Carefull with this one: I have seen SLX completely ignore a sub or function that had a free-form name (MyReallyCoolSub) that was then "selected" from the dropdown under Events. I tell my team to double click on the event for the control so that it "stubs out" the sub, then either call their sub from there or paste their code in that sub. You might get away 9 times out of ten, but that tenth time will make your life hell trying to figure out what is going wrong
Michael |
|
|
| |
|