SPONSORS:






User Tag List

Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Jun 2000
    Location
    Hartford, CT, USA
    Posts
    163
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using a variable as a window component

    Is there a way we can directly use a string to execute a method on a window component with identical name?
    e.g. my window components are
    PushButton 100
    PushButton 200
    PushButton 300

    And in the testcase we pass the variable

    testcase TestSomething(int iNo1)
    //this is what I would like to do
    // if the value passed is 100 it will
    wMainWin.iNo1.click()

    Can anyone help?
    Jaimini Bhatt

  2. #2
    Member
    Join Date
    Jun 2001
    Location
    Berkeley, CA, USA
    Posts
    67
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using a variable as a window component

    You can use the @ operator - but a switch statement would work just as well.

    Edit:

    You can also use dynamic instantiation.

    wParent.PushButton("{iVariable}").Click()

  3. #3
    Senior Member
    Join Date
    Jun 1999
    Location
    Fremont, CA, USA
    Posts
    355
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using a variable as a window component

    Yes, but not exactly how you have it. There are a few ways of doing it:

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">testcase TestSomething(int iNo1)
    wMainWin.PushButton(&quot;{iNo1}&quot.click()</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Or, if you could pass in the declared name of the button and use the @ operator:

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">testcase TestSomething(string sButton)
    wMainWin.@(sButton).click()</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">While this work out for you?

  4. #4
    Senior Member
    Join Date
    Jun 2000
    Location
    Hartford, CT, USA
    Posts
    163
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using a variable as a window component

    Thanks both of you.
    Jaimini Bhatt

 

 

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:32 AM.

Copyright BetaSoft Inc.