Announcement

Collapse
No announcement yet.

Yet another HSPI plugin library

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #61
    Main function is
    Code:
    public string RadioButtonEnum(Enum en, string name, bool enabled = true, string[] names = null, string style = null, object[] supported = null)
    Enum en Selected value of the Enum
    string name Control name (id) - must be unique
    bool enabled Can disable selection
    string[] names If specified - list of replacement names for Enum values, should match size and order of Enum values
    string style Display style, i.e. Button or Radio
    object[] supported Limit List of Enum values which should be displayed

    And some 'mapping' wrappers for the above function (note: the var_name is used also as control name):

    Code:
    protected string RadioButtonEnum<TEnum>(Enum en, string var_name, object parent, string[] names = null, string style = null, object[] supported = null)
    Function automatically mapping parent.var_name to the selected Enum value
    .
    Enum en See above
    string var_name Name of variable/property of 'parent' object to be set when selection changes
    object parent Oject conatining mapped variable/property
    string[] names See above
    string style See above
    object[] supported See above
    .
    Code:
    protected string RadioButtonEnum<TEnum>(Enum en, string var_name, object parent, string[] names = null, string style = null, TEnum[] supported = null)
    Same as above, but 'supported' is an array of Enum values, not object[]

    Code:
    protected string RadioButtonEnum<TEnum>(Enum en, string var_name, object parent, string[] names = null, string style = null)
    Same as above, but no 'supported' array, so all Enum values are displayed (except for 'unknown')

    Comment


    • #62
      Very helpful. I was struggling with the first parameter. Now I know it represents the selected value, i can make it work. Thanks.

      Comment


      • #63
        Originally posted by Blob View Post
        Very helpful. I was struggling with the first parameter. Now I know it represents the selected value, i can make it work. Thanks.
        In main function it presents both the Enum type and selected value - so I can show list of possible values with the current value selected

        Took me a while to come up with this idea, but end result is pretty cool

        Comment


        • #64
          Originally posted by alexbk66 View Post

          In main function it presents both the Enum type and selected value - so I can show list of possible values with the current value selected

          Took me a while to come up with this idea, but end result is pretty cool
          I totally agree. Once you know how it works, it is very cool.

          Comment

          Working...
          X