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!
|
|
Item : Generically Setting a Form to Read Only : SLX 754
Posted: 19 Apr 12 11:14 AM
|
fiogf49gjkf0d Item : Generically Setting a Form to Read Only : SLX 754
Any one had issues with Class in SLX754 ?
I have used in a SLX62x version for a few years but on upgrade is fails with "Variable Not Set : m_form" in the following "Let"
Public Property Let Form(ByRef val) m_form = val End Property
Nothing has changed apart from slx version, I am using the forms from SLX626
I am setting the Opportunity Product Tab to ReadOnly (or not) from the Opportunity Detail
Dim frm Set frm = New FormWrapper frm.Form = Application.Forms("Opportunity:Products")
frm.ReadOnly = false |
|
|
|
Re: Item : Generically Setting a Form to Read Only : SLX 754
Posted: 19 Apr 12 11:31 AM
|
fiogf49gjkf0d You'd be better off rotating through the forms collection :
Sub RefreshOppDetailView Dim i
For i = 0 To Application.Forms.Count - 1 If Application.Forms.Item(i).Name = "frmOpportunityDetail" Then Application.Forms.Item(i).Refresh Exit For End If Next End Sub
That way, you can do what you need once found (if not found, do nothing). |
|
|
| |
| |
| |
| |
| |
|
Re: Item : Generically Setting a Form to Read Only : SLX 754
Posted: 20 Apr 12 2:03 AM
|
fiogf49gjkf0d Once you have the form - you can then access its controls? I've never found that works anyway (always seems to be r/o even when it isn't - see LookupEdit). Besides, if I want granularity I always use:
<p>cName = "pklQuoteType|lueVessel|lueCustomer|lueBroker|lueBroConID|lueAccConID|rgSendTo|pklStatus|txtLostTo aControl = Split (cName,"|")
' If a NAV quote - do not enable controls (R/O) always If cbQuoteSource.Checked = False then For i = 0 to ubound(aControl) Execute aControl(i) & ".Enabled = " & gState Next Else For i = 0 to ubound(aControl) Execute aControl(i) & ".Enabled = " & Not cbQuoteSource.Checked Next End If
That way, I can get to any control and do what I want conditionally. |
|
|
|
Re: Item : Generically Setting a Form to Read Only : SLX 754
Posted: 20 Apr 12 9:17 AM
|
fiogf49gjkf0d Mike:
Did you figure out your issue with the Variable not Set?
Maybe you need to figure out if val is a valid object. If it is not, then off course that would cause problems.
If val in indeed a valid object, then maybe you need to "Set" the variable (not thinking about the Property type - Let or Set), but the actual assignment of the variable:
m_form = val or Set m_form = val (since you are dealing with objects). |
|
|
|
Re: Item : Generically Setting a Form to Read Only : SLX 754
Posted: 20 Apr 12 9:40 AM
|
fiogf49gjkf0d I have amended the calling procedure as per mike spragg suggestion. At this time, that seems to have solved it. However this has fooled me before and "appeared fixed", until the next time 
So at the moment I have this
Dim i For i = 0 To Application.Forms.Count - 1 If Application.Forms.Item(i).Name = "frmOppProducts" Then Set frm = New FormWrapper frm.Form = Application.Forms("Opportunity:Products") frm.ReadOnly = false Exit For End If Next |
|
|
|
Re: Item : Generically Setting a Form to Read Only : SLX 754
Posted: 20 Apr 12 9:48 AM
|
fiogf49gjkf0d Also, you could always take a look at how it is done on the SLX_Common script (getting Form and Control References).
There is a function called "RefreshTabMiddleView. It takes 2 parameters: a Plugin Name and a Control Name (second one is optional).
It checks the Main Views Detail and Tab Views (could be easily extended to check the Detail form for the Main View).
If it finds the Form, it calls a function named "RefreshControl which calls Control.Refresh.
In the past I have copied these 2 functions (onto my own Include Script) and used them to set controls to Read Only. I rely on the Same code to find the Form, but instead of Calling Control.Refresh, I take whatever action I need to take on the Control.
As a separate Example, I once used this approach to set the "Cursor" of all controls to a Busy Cursor and then back to normal during a lengthy operation (don't ask why.... ). |
|
|
|