SPONSORS:






User Tag List

Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Oct 2001
    Location
    CA, USA
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating method for generic-declared obj

    how do I create a method on a generically declared object ?

    I suggested using SilkTest's supplied TestApp.exe that comes with SilkTest. The simple example to see the problem I am facing is to declare TestApp.exe in a frame.inc file,declared the xButton dialogbox, then generically declared theButton PushButton (using the ~ActiveApp/[PushButton] syntax for this object). Then create a method to click on this Pushbutton. The problem is, using the code I tried it does not ever click on this PushButton.

    I would like to know how to accomplish this if possible, or to gain a thorough understanding as to why it cannot be done AND what some workarounds might be to accomplish it.

    I skipped including declaration of TestApp.exe. Assume that I have already 'picked' TestApp's menu of Control, then picked menuitem Pushbutton to invoke the xPushButton dialog box.

    Listed below is the declaration of the xPushbutton dialog box (with the pushbutton of TheButton commented out) - it has been declared generically.

    [-] window DialogBox xPushButton
    [ ] tag "Push Button"
    [ ] parent TA
    [-] PushButton TheDefaultButton
    [ ] tag "The default button"
    [-] // PushButton TheButton
    [ ] // tag "The button"
    [+] PushButton TheGraphicalButton
    [ ] tag "The graphical button"
    [+] PushButton TheCustomButton
    [ ] tag "The custom button"
    [+] StaticText LabelText
    [ ] tag "Label"
    [+] TextField Label
    [ ] tag "Label"
    [+] PushButton SetLabel
    [ ] tag "Set Label"
    [+] PushButton Exit
    [ ] tag "Exit"
    [+] PushButton Popup
    [ ] tag "Popup"
    [+] CheckBox Enabled
    [ ] tag "Enabled"


    [-] window PushButton pbTheButton
    [ ] tag "~ActiveApp/[PushButton]The button"
    [-] Click()
    [ ] xPushButton.SetActive()
    [ ] Print("Before")
    [ ] pbTheButton.Click()
    [ ] Print("After")
    [ ] Print()
    [ ]

    [-] window DialogBox dTA//TestApplication
    [ ] tag "Test Application"
    [ ] parent xPushButton
    [+] PushButton OK
    [ ] tag "OK"
    [+] CustomWin Icon1
    [ ] msw tag "[Icon]#1"
    [-] StaticText stcBClk
    [ ] tag "Click on 'The button' detected"


    in a .t file here is my code.
    -------------------------------

    [+]PushTheButton()
    [ ]
    [ ]pbTheButton.Click()
    [ ]
    [-]if dTA.Exists()
    [ ]dTA.SetActive()
    [ ]Print(dTA.StaticText("#1").GetText())

    When run, the results file has the word 'Before'written to it repeatedly, but the thebutton is never clicked on.

    There you go. Any thoughts ?




    ------------------

  2. #2
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating method for generic-declared obj

    Any chance you can used the CODE and /CODE tags (each in square brackets) before and after your code, so we can see the indentation properly? It's hard to read the code otherwise.

    ------------------

  3. #3
    Member
    Join Date
    Oct 2001
    Posts
    93
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating method for generic-declared obj

    jknews,

    Your probelm here is not in the way you have implemented the windows - that is fine. It is in the Click method. You have a window called pbTheButton and in the Click method you have defined you call pbTheButton.Click(). This mean your click method is calling itself - hence the looping through 'Before'.

    Change you click method to used the derived keyword as below

    [-] Click()
    [ ] xPushButton.SetActive()
    [ ] Print("Before")
    [ ] derived::Click()
    [ ] Print("After")
    [ ] Print()

    and all will be fine. The derived keyword tell Silk to use the method from the derived class, not the one being created or changed.

    Paul

    ------------------
    Paul Tucker
    Merit AT
    www.merit-at.com

 

 

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 09:15 AM.

Copyright BetaSoft Inc.