SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Jun 2010
    Posts
    15
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    VbButton Child Window Problems *updated*

    I have a script that clicks a button that opens a new window. I used the record option and just recorded the button click and the window to be opened. I have found when running my script that sometimes the window that is being opened has different names ("MDIForm1_5" or "MDIForm1_6"). Which really screws up my script because the operations im trying to do wont work because it cant find the window.

    Here is what i tried to come up with, but i am getting an error saying the object cannot be found


    *The current window is passed into the function from another function*



    <font class="small">Code:</font><hr /><pre>

    Function EnterTerritoryDetails(Byval objExcel, rowNumber, objMain)
    Set localobjExcel=objExcel
    strParamValue=localobjExcel.Cells(rowNumber,8).Val ue
    strParamCounty=localobjExcel.Cells(rowNumber, 5).Value
    Set objParent=objMain

    WindowName="frmGetTerritory"
    Set objChildWindow=objParent.WinObject("ThunderRT6Comm andButton").VbWindow(WindowName)



    objChildWindow.VbButton("nativeclass:=ThunderRT6Co mmandButton", "vbname:=cmdZoneLookup").Click
    objChildWindow.VbComboBox("cbo").Select LTrim(RTrim(strParamValue))
    objChildWindow.WinEdit("Edit").Set strParamValue
    objChildWindow.WinEdit("Edit").Type micReturn
    objChildWindow.GetTextLocation (UCase(strParamCounty) ,x1,y1,x2,y2)
    objParent.VbWindow("frmGetTerritory").Click x1 + 5,y1 + 5
    objChildWindow.VbButton("Set Ter/Zone").Click

    End Function </pre><hr />


    Any help would be much appreciated [img]/images/graemlins/smile.gif[/img]

  2. #2
    Super Member Jonty's Avatar
    Join Date
    Jan 2007
    Location
    India
    Posts
    1,266
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Child Window

    Set objChildWindow=objParent.WinObject("ThunderRT6Comm andButton").VbWindow(WindowName)

    Why is the object recognized as Winobject?
    Where is the value frmGetTerritory retrieved from?

    You can look at using regular expression for the last character in the window name.

    Also i see multiple window objects, so you got to be specific on which obj the issue is.
    Cheers
    Jonty..
    -- Here to Learn and share ---

  3. #3
    Junior Member
    Join Date
    Jun 2010
    Posts
    15
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Child Window

    Thanks, That helped a lot,I got the child window saved into objChildWindow, but still cant figure out how to test the components on the new window. It says It cannot find the buttons object's parent. Here is my new code, I have tried clickin the buttons more than one way



    <font class="small">Code:</font><hr /><pre> Function EnterTerritoryDetails(Byval objExcel, rowNumber, objMain)
    Set localobjExcel=objExcel
    strParamValue=localobjExcel.Cells(rowNumber,8).Val ue
    strParamCounty=localobjExcel.Cells(rowNumber, 5).Value
    Set objParent=objMain

    '*******sets the child window********
    Set objChildWindow=objParent.VbButton("nativeclass:=Th underRT6CommandButton", "vbname:=cmdZoneLookup").VbWindow("vbname:=frmGetT erritory")

    '***Clicks button on original window to open up frmGetTerritory Window***
    objParent.VbButton("nativeclass:=ThunderRT6Command Button", "vbname:=cmdZoneLookup").Click

    '***set combo box***
    objChildWindow.vbCombobox("nativeclass:=ThunderRT6 ComboBox","vbname:=cbo").Select LTrim(RTrim(strParamValue))

    'Find location of text on screen to click
    'objChildWindow.GetTextLocation (UCase(strParamCounty) ,x1,y1,x2,y2)

    'Click Location of the text
    ' objChildWindow.Click x1 + 5,y1 + 5

    'Click button to close screen
    objChildWindow.VbButton("regexpwndtitle:=&amp;Set Ter/Zone").Click 'try number 1 to click button
    objChildWindow.VbButton("nativeclass:=ThunderRT6Co mmandButton", "vbname:=cmdSetTerritory").Click 'try number 2 to click button

    End Function </pre><hr />


    <font color="red"> ERROR: Cannot find the "[ VbButton ]" object's parent "[ VbWindow ]" (class VbWindow). Verify that parent properties match an object currently displayed in your application. </font>

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin 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 08:25 PM.

Copyright BetaSoft Inc.