Can I Use an Enum type in a Select Case statement.

Discuss the Firewing language

Can I Use an Enum type in a Select Case statement.

Postby johngb » Sat Feb 06, 2016 5:35 pm

e.g.

Code: Select all
Public Enum tObjState
   Hidden
   Disabled
   Enabled
   Pressed
end Enum

Dim State as tObjState

Select State                           
   Case State.Hidden Color = ActiveScreenColor     
   Case State.Disabled Color = DisabledColor   
   Case else Color = SolidColor
end Select


JohnB
johngb
 
Posts: 19
Joined: Thu Dec 25, 2014 12:00 pm

Re: Can I Use an Enum type in a Select Case statement.

Postby Jerry Messina » Sat Feb 06, 2016 10:26 pm

You can, but you need to use the enum identifier (tObjState) to qualify each of the cases.
Also, the VB-style syntax requires you to put the assignment on a new line

Code: Select all
    Select State                           
       Case tObjState.Hidden
            Color = ActiveScreenColor     
       Case tObjState.Disabled
            Color = DisabledColor   
       Case else
            Color = SolidColor
    end Select
Jerry Messina
 
Posts: 280
Joined: Thu Feb 14, 2013 10:16 am


Return to Language

Who is online

Users browsing this forum: No registered users and 2 guests

cron

x