Sage 300 classic desktop provides various user interfaces i.e. screens which are basically OCX files i.e. “ActiveX Control Objects”. The entry screens generally has windows maximize and minimize buttons but for Report user interfaces or those user interfaces on which no tabular data or grid present the maximize button might been disabled. While customizing these Sage 300 user interfaces on which maximize button is disabled, developers may face the difficulty to achieve the same effect on customized OCX. In this blog we are going to discuss simple code changes to be done in the standard code to achieve the same.
New Stuff: Migrate AP Payments from Sage Pro to Sage 300 ERP
The visibility of maximize and minimize buttons for the Accpac user interface container’s is depend on the global declarations done while creating any OCX i.e. depend on the value (True / False) set for the “ACCPACUIResizable” Property.
If this has been set to “True” then both Minimize and Maximize buttons are visible and if it is set as “False” both Maximize and Minimize buttons will not appear.
To make only Minimize button visible on Accpac UI below code changes can be done:
- In the module “ACCPACUIGlobals” in general declarations set the “ACCPACUIResizable” property to false.
“Public Const ACCPACUIResizable As Boolean = False”
2. In the user control code in “SaveUISize()” subroutine make the changes enclosed under “’B-GT… ‘E-GT’” below :
Private Sub SaveUISize()
On Error Resume Next
Dim lParentHwnd As Long
Dim bMaximized As Boolean
Dim bMinimized As Boolean
‘ Find the top-level parent window (doesn’t
‘ include owner, i.e. caller, windows).
lParentHwnd = GetAncestor(UserControl.hWnd, _
GA_ROOT)
If Err.Number = 0 Then
‘B-GT-Commented code line and added code for maximizing button disabling
‘bMaximized = CBool(IsZoomed(lParentHwnd))
bMaximized = False
‘E-GT-Commented code line and added code for maximizing button disabling
bMinimized = CBool(IsIconic(lParentHwnd))
Else
‘ The parent doesn’t have an Hwnd, so assume
‘ it is not maximized or minimized.
bMaximized = False
‘B-GT-Commented code line and added code for maximizing button disabling
‘bMinimized = False
bMinimized = True
‘E-GT-Commented code line and added code for maximizing button disabling
Err.Clear ‘ this error is now handled
End If
If (bMaximized = True) Or (bMinimized = True) Then
‘ GET OUT! DON’T save the size, but DON’T
‘ clear the previous saved size either!
Err.Clear
Exit Sub
End If
‘ IF WE GOT TO HERE, WE NEED TO DEAL WITH THE
‘ ACCPAC PROPERTIES.
With mSession.GetAccpacProperty
.menuID = ACCPACProgramName
.objectID = ACCPACProgramName
‘ See if we need to save/clear the height.
.keyword = UIHEIGHT_KEY
If ScaleHeight <= msMinHeight Then
.PropClear
Else
Dim strUIHeight As String
strUIHeight = CStr(ScaleHeight)
.PropPut CVar(strUIHeight), Len(strUIHeight)
End If
‘ See if we need to clear/save the width.
.keyword = UIWIDTH_KEY
If ScaleWidth <= msMinWidth Then
.PropClear
Else
Dim strUIWidth As String
strUIWidth = CStr(ScaleWidth)
.PropPut CVar(strUIWidth), Len(strUIWidth)
End If
End With ‘ mSession.GetAccpacProperty
Err.Clear
End Sub
The above changes will allow us to get the OCX user interface with only minimize and close button. Kindly refer to below customized user interface for the reference:
As you can see in the screenshot above the “Maximized” button is disabled for the customized OCX.
About Us
Greytrix is a one stop solution provider for Sage ERP and Sage CRM needs. We provide complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third party add-on development and implementation expertise.
Greytrix has some unique solutions of Sage 300 integration with Sage CRM, Salesforce.com and Magento eCommerce along with Sage 300 Migration from Sage 50 US, Sage 50 CA, Sage PRO, QuickBooks, Sage Business Vision and Sage Business Works. We also offer best-in-class Sage 300 customization and development services to Sage business partners, end users, and Sage PSG worldwide.
For more details on Sage 300 Services, please contact us at accpac@greytrix.com. We will be glad to assist you.