Make preference available as menu toggle

Build 1501 on 14/Nov/2017  This topic last edited on: 21/Mar/2016, at 18:44

Boolean preferences

You can make a Boolean personal preference available as a menu toggle. Create two new scripts: a 'Chk' script that checks if toggle is on or off and enables the tick mark in the menu, and the actual toggle script

 

  Public Overridable Function Chk_IsAFCS_PromptNS() As Boolean

    'v1 on 10/Nov/14 (BS): returns the status of Keep total height when scaling headline

    Return SystemUserOptions.AFCS_PromptNS

  End Function

 

  <ShellCommand(CanExecute:="Ena_Always", IsChecked:="Chk_IsAFCS_PromptNS")> _

  Public Overridable Sub ToggleKeepTH()

    'v1 on 10/Nov/14 (BS): toggle the status of Keep total height when scaling headline

    SystemUserOptions.AFCS_PromptNS = Not SystemUserOptions.AFCS_PromptNS

End Sub

Integer preferences

You can make an integer personal preference available as a menu toggle. Create two new scripts: a 'Chk' script that checks if toggle is on or off and enables the tick mark in the menu, and the actual Set script.

The example below shows the enablers and the scripts for the selection on what to do on picture replacing:

 Public Overridable Function Chk_F_IROCmb_Prompt() As Boolean

    'v1 on 20/Nov/14 (BS): returns the status of When Replacing Image on Page = Prompt (0)

    Return SystemUserOptions.F_ImgReplaceOptionCmb = 0

  End Function

  <ShellCommand(CanExecute:="Ena_Always", IsChecked:="Chk_F_IROCmb_Prompt")> _

  Public Overridable Sub SetIROCmb_Prompt()

    'v1 on 20/Nov/14 (BS): toggle the status of When Replacing Image on Page to Prompt (0)

    SystemUserOptions.F_ImgReplaceOptionCmb = 0 ' turn on

  End Sub

  Public Overridable Function Chk_F_IROCmb_Resize() As Boolean

    'v1 on 20/Nov/14 (BS): returns the status of When Replacing Image on Page = Resize (1)

    Return SystemUserOptions.F_ImgReplaceOptionCmb = 1

  End Function

  <ShellCommand(CanExecute:="Ena_Always", IsChecked:="Chk_F_IROCmb_Resize")> _

  Public Overridable Sub SetIROCmb_Resize()

    'v1 on 20/Nov/14 (BS): toggle the status of When Replacing Image on Page to Resize (1)

    SystemUserOptions.F_ImgReplaceOptionCmb = 1 ' turn on

  End Sub

  Public Overridable Function Chk_F_IROCmb_Fit() As Boolean

    'v1 on 20/Nov/14 (BS): returns the status of When Replacing Image on Page = Fit (2)

    Return SystemUserOptions.F_ImgReplaceOptionCmb = 2

  End Function

  <ShellCommand(CanExecute:="Ena_Always", IsChecked:="Chk_F_IROCmb_CropFit")> _

  Public Overridable Sub SetIROCmb_Fit()

    'v1 on 20/Nov/14 (BS): toggle the status of When Replacing Image on Page to Fit (2)

    SystemUserOptions.F_ImgReplaceOptionCmb = 2 ' turn on

  End Sub

  Public Overridable Function Chk_F_IROCmb_CropResize() As Boolean

    'v1 on 20/Nov/14 (BS): returns the status of When Replacing Image on Page = Crop/Resize (3)

    Return SystemUserOptions.F_ImgReplaceOptionCmb = 3

  End Function

  <ShellCommand(CanExecute:="Ena_Always", IsChecked:="Chk_F_IROCmb_CropResize")> _

  Public Overridable Sub SetIROCmb_CropResize()

    'v1 on 20/Nov/14 (BS): toggle the status of When Replacing Image on Page to Crop/Fit (4)

    SystemUserOptions.F_ImgReplaceOptionCmb = 3 ' turn on

  End Sub

  Public Overridable Function Chk_F_IROCmb_CropFit() As Boolean

    'v1 on 20/Nov/14 (BS): returns the status of When Replacing Image on Page = Crop/Fit (4)

    Return SystemUserOptions.F_ImgReplaceOptionCmb = 4

  End Function

  <ShellCommand(CanExecute:="Ena_Always", IsChecked:="Chk_F_IROCmb_CropFit")> _

  Public Overridable Sub SetIROCmb_CropFit()

    'v1 on 20/Nov/14 (BS): toggle the status of When Replacing Image on Page to Crop/Fit (4)

    SystemUserOptions.F_ImgReplaceOptionCmb = 4 ' turn on

  End Sub