How to hide custom control when relevant tab is not active

By | April 26, 2011
When browsing through the forums we generally come across situations where someone was looking for a solution to hide his custom FEC control when the Tab on which it is placed is not active.
This is one problem that even I had faced in our initial days and this is something that is very commonly required and has to be taken care of every time you add a custom control to Standard Accpac OCX. We have defined this clearly in our SDK training program for our in-house developers, however after coming across this thread I thought I should share this small tip with the new comers to the Sage Accpac SDK developer community and hence this blog.
What happens in Accpac is that whenever we customize an OCX to add a custom control we just position it over the Accpac OCX and since our custom control is not actually placed within the Tab Control of Accpac OCX, when we switch between tabs our control stays on the screen for all the tabs, as these tabs only control the visibility of controls that are actually placed on them.
This is something that has to be taken care of by writing a small piece of code, so how do we do it…(As always my friend make sure you have taken proper necessary backups)
Let us assume that we need to customize Order entry screen and we need to place our own custom FEC control on the “Order” Tab of order entry screen. So it should only be visible when user clicks on Order Tab or when the Order Tab is Active on rest of the tabs user should not see this field.
First set the reference for the SStab from the reference window and define the object as below.
Private WithEvents OETab As SSTab
Then set the control of the tab on OnUIAppOpened event.
Set OETab = AccpacOE1100UICtrl1.UIAppControls.Item(“stbOrderEntry”).GetControl
Then on click of OETab control to get the event procedure, just write the code as below.
Private Sub OETab_Click(ByVal PreviousTab As Integer)
If OETab.Tab = 0 Then //Comment : – Here 0 is the value of the “Order” tab in order entry screen.
FECComboDescription.Visible = True
Else
FECComboDescription.Visible = False
End If
End Sub

For any queries or more information, please drop us an email at sage@greytrix.com.

About Us
Greytrix a globally recognized Premier Sage Gold Development Partner is a one stop solution provider for Sage ERP and Sage CRM needs. Being recognized and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third party add-on development and implementation expertise.

Greytrix offers unique GUMU™ integrated solutions of Sage 300 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 and integration service for applications such as POS | WMS | Payroll | Shipping System | Business Intelligence | eCommerce for Sage 300 ERP and in Sage 300c development services we offer services such as upgrades of older codes and screens to new web screens, newer integrations using sdata and web services  to Sage business partners, end users and Sage PSG worldwide. Greytrix offers over 20+ Sage 300 productivity enhancing utilities that we can help you with such as GreyMatrixDocument AttachmentDocument NumberingAuto-Bank ReconciliationPurchase Approval SystemThree way PO matchingBill of Lading and VAT for Middle East.

For more details on Sage 300 and 300c Services, please contact us at accpac@greytrix.com. We will be glad to assist you.