Ross
In my experience there is always a controlling loop that resides in an object outside of the tabs. This could be a dummy field that resides within a cycle that paints the main format.
The logic associated with the function keys (that is assigned to the tabs) sets the tab and can change the tab graphic. It also exits the cycle returning control back to the master loop. I have included some code examples for your review.
The following code is executed in the controlling loop (on a dummy field or any other event point outside the tab cycles)
//
// set up the default tab graphic. #TAB can be set dynamically via a variable as the user may be returing back to this screen after exiting.
//
CASE #TAB
WHEN 1:
ByUserBarTab.Graphic = 'barbuttonmouseover.png'
#MASTER_TAB = #TAB
CALL 1
WHEN 2:
ByGroupBarTab.Graphic = 'barbuttonmouseover.png'
#MASTER_TAB = #TAB
CALL 1
WHEN 3:
ByFilterBarTab.Graphic = 'barbuttonmouseover.png'
#MASTER_TAB = #TAB
CALL 1
ENDCASE
//
WHILE $EXIT = ''
// 04/12/10 - JSO - TR7989 - Added group tab
CASE #TAB
WHEN 1:
// Clear group type so that we don't filter out types on the user tab
$GROUP_TYPE = ''
LSCALL('UserCycle')
WHEN 2:
LSCALL('ByGroupCycle')
WHEN 3:
LSCALL('ByFilterCycle')
WHEN 4:
LSCALL('BatchReassignCycle')
OTHERWISE:
// Should never get here
MSG(10,#TAB) // ERROR - Unknown Tab Number %1
FNEXIT
ENDCASE
ENDWHILE
The following logic is defined on the logic associated with the tab icon. We used the same logic on all tabs as we gave the tabs accending function keys with tab one (in this example) having function key 45 and tab 4 having function key 48.
IF #TAB # @FNKEY - 44 THEN
// Set previous tab to inactive graphics
CASE #TAB
WHEN 1:
ByUserBarTab.Graphic = 'barbutton.png'
WHEN 2:
ByGroupBarTab.Graphic = 'barbutton.png'
WHEN 3:
ByFilterBarTab.Graphic = 'barbutton.png'
WHEN 4:
BatchReassignBarTab.Graphic = 'barbutton.png'
ENDCASE
// Set selected tab to active graphics
#TAB = @FNKEY - 44
CASE #TAB
WHEN 1:
ByUserBarTab.Graphic = 'barbuttonmouseover.png'
#MASTER_TAB = #TAB
CALL 1
WHEN 2:
ByGroupBarTab.Graphic = 'barbuttonmouseover.png'
#MASTER_TAB = #TAB
CALL 1
WHEN 3:
ByFilterBarTab.Graphic = 'barbuttonmouseover.png'
#MASTER_TAB = #TAB
CALL 1
WHEN 4:
BatchReassignBarTab.Graphic = 'barbuttonmouseover.png'
RescheduleIcon.Visible = FALSE
AcceptRenewalIcon.Visible = FALSE
TaskHistoryIcon.Visible = FALSE
RefreshIcon.Visible = FALSE
ChangeIcon.Visible = FALSE
MessageIcon.Visible = FALSE
CreateNewBatchReassnIcon.Label = ' Batch Reassign'
ENDCASE
PUTNCOM('CORPORATEDIARYTAB',#MASTER_TAB)
//
LSEXIT
ENDIF
The final point of interest is to clear the format of the tab cycle upon exit. We placed the following code in the exit logic of the tab cycle(s). Obviously the tag names differ depending on the cycle that we are in.
UserCycle.ClearFormat()