SPONSORS:






User Tag List

Results 1 to 5 of 5

Thread: Enumerated type

  1. #1
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enumerated type

    I found one solution:

    for the lazy ppl.
    My problem was that if I directly accessed an element from an enumerated type and stuff it in an string like "{car}" I will get a string 'car' instead of '1'. So make a function solves this problem.

    Please let me know about a better way.

  2. #2
    Senior Member
    Join Date
    Aug 1999
    Location
    MA
    Posts
    129
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enumerated type

    You can use a typecast. In Silk this is done like this [SilkTest type you want] with the square brackets, and the type in the brackets.

    See example below given this in in a test.inc file. Since you want the INTEGER representation of the enum, typecast [INTEGER]:
    Use a demo testcase like this in test.t
    And get a result like this:

    [This message has been edited by styler (edited 03-14-2001).]
    Steven Tyler
    Manager - Performance Engineering

    Kronos Incorporated
    tel: +1 978 947 4219

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Enumerated type

    Easy one:

    How can you access directly the content of a enumerated type?

    I.E.: type myEnum is enum
    a
    b
    c


    now can I use a , b, and c as array index or more useful as a integer variable?

    I tried CheckBox("Show[{b}]").Click()
    but b is not seen as a variable but seen as 'a' string.

  4. #4
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enumerated type

    Styler:

    You are the MAN!!! LOL I haven't thought about casting. This will save me some time.


    I bow infront of you for this usefull hint:b

  5. #5
    Senior Member
    Join Date
    Nov 2000
    Location
    Bloomington, IL
    Posts
    142
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enumerated type

    I like the last answer but why not simplify it and establish an integer and the set the integer equal to the integer value of the enumeration.

    [-] type COLOR is enum
    [ ] red
    [ ] green
    [ ]
    [ ]
    [-] Main()
    [ ] INTEGER iEnum
    [ ]
    [ ] Print([integer]red)
    [ ] iEnum = [integer]red
    [ ] Print(str(iEnum))

    Mike

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:18 AM.

Copyright BetaSoft Inc.