Article Details
| Id: | 12501 |
| Product: | finPOWER Connect |
| Type: | NEW |
| Version: | 2.02.04 |
| Opened: | 12/12/2014 |
| Closed: | 12/12/2014 |
| Released: | 13/02/2015 |
| Job: | J014641 |
Scripts; Action Scripts; Can now update the Icon that is displayed on the form
Action Scripts can now update the Icon that is displayed on the form.
The following Script sample shows how to toggle an Action's Icons between two different states. It uses the Client's "Tag" property purely for the sake of example:
Public Function Main(ByVal userInterface As ISUserInterfaceBL, ByVal reports As ISfinReports, ByVal eventId As String, ByVal targetObject As Object, ByVal parameters As ISParameters, ByRef requiresRefresh As Boolean) As BooleanDim Client As finClient' Assume SuccessMain = True' InitialiseClient = DirectCast(targetObject, finClient)' Handle EventsSelect Case eventIdCase "Execute"' Use Tag to determine 'Pinned' state (just for example's sake) and toggle itIf Client.Tag Is Nothing OrElse CStr(Client.Tag) = "Pinned" ThenClient.Tag = "Unpinned"ElseClient.Tag = "Pinned"End If' RefreshrequiresRefresh = TrueCase "GetState"' Determine Icon and CaptionIf Client.Tag Is Nothing OrElse CStr(Client.Tag) = "Pinned" ThenParameters.SetString("caption", "Pin")parameters.Setstring("icon", "Pin_Green")ElseParameters.SetString("caption", "Unpin")parameters.Setstring("icon", "Pin_Green_Clear")End IfParameters.SetBoolean("enabled", ScriptInfo.FormRecordMode = iseFormRecordMode.Loaded)End SelectEnd Function
NOTE: In this case, the "Execute" event is being used to toggle the icon. This event must set requiresRefresh to True to force the Clients form to refresh itself otherwise the icon will not be updated.