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!
|
|
Opening and Closing forms 
Posted: 14 Nov 08 11:06 AM
|
So I need to go from Form A then go to an Account Detail screen then open Form B and pass an ID from A to B I have looked at Saleslogix and the only times i could find when they went from one Manage Form to another they did not actually close the first one they just made the 2nd bigger and hid the first one. the only way i have found to do this is from Form A use application.BasicFunctions.SetCurrentAccountID then set a global variable and close form A then on the Account details screen I added an if statement to check for the global variable and call Form B
this works. I was just wondering if any one has hound a cleaner way to do this. |
|
|
|
Re: Opening and Closing forms 
Posted: 15 Nov 08 5:42 AM
|
What you need to do is invoke a view and then, once invoked, get the details from it. Below is a sample.
Dim objMainView Dim objDetail
Set objMainView = Application.MainViews.Add("EventManagement:Display Event", 0, False)
objMainView.CurrentID = AttEventID ' Set to PrimaryID of the NEW form objMainView.BorderStyle = 3 objMainView.Caption = Application.Translator.Localize("Display Events") Set objDetail = objMainView.DetailsView
objDetail.ebMyObject.Text = "example" ' This sets data on the invoked form
If objMainView.ShowModal = mrOK Then ' Do something here - this is the OK button being pressed myVar = objDetaill.ebMyObject.Text ' This gets data off the invoked form End If
Set objMainView = Nothing Set objDetail = Nothing
|
|
|
|
Re: Opening and Closing forms 
Posted: 17 Nov 08 2:35 PM
|
That code would open a form pass it some data then when the form closes it would receive some data then continue it's script (and close), Right?
I basically made a form that functions an advanced look-up. I don't need it to receive any data just to pass an ID to another form. The catch is that i need it to close as it opens the 2nd form. or at least it needs to appear like the same action. |
|
|
|
Re: Opening and Closing forms 
Posted: 17 Nov 08 5:35 PM
|
Correct. Yes, this is how it works. You're best best, in this instance, would be to use a global variable to set/get/unset to achieve this. |
|
|
|
Re: Opening and Closing forms 
Posted: 19 Nov 08 10:42 AM
|
thank you.
P.S. this should probably go in its own thread, but do you know if you can dynamically set the width and height property's of a form. Because when trying to get this to work at one point we tried to just shrink the form to 1x1 and nothing happened when we used frmName.width = 1. |
|
|
|
Re: Opening and Closing forms 
Posted: 19 Nov 08 11:11 AM
|
You used to be able to do this using .width, .height - but, nowadays, it sets itself dynamically based on the far right control (calculates the size automatically). So, if you make the form 1x1 it should only be 1x1. |
|
|
|
Re: Opening and Closing forms 
Posted: 17 Dec 08 2:25 PM
|
John Paul,
I'm in the middle of a project where I wanted to dynamically control the form size. What I figured out was that when you open the form with Application.Basicfunctions.DoInvoke, the form size could only be modified in the AXFormOnOpen Event. As a result, I decided to open the form as a mainview, which I could then be resized at will. The only problem was that I needed to identify the mainview object from within the form code, so I could set the size properties of the proper window.
I expected that Application.Mainviews.Activeview to return the object of the mainview containing the form at runtime, but no, it couldn't be that easy. So, I ended up going the route of looping through the open mainviews, until I found the one having the caption I set when I opened the form as a mainview.
Here is the code I'm using to identify the mainview object from within the scripting on my form. Please be aware, this will not work if you have multiple mainviews using the same caption. You should also know that I'm using Version 7.2.2, but I think this works back to 6.2
For i = 0 to Application.MainViews.Count -1 If Application.MainViews.item(i).caption = "Some Unique Caption" Then Set m_objMV = Application.MainViews.Item(i) Exit Sub End If Next
Once the proper mainview is found, all you have to do is set the size properties, just like you would with the form (m_objMV.Width = 300, etc...)
|
|
|
|