Skip to content

How to use Get methods for swfToolbar

New Discussion
Laxmikant
Laxmikant asked on Apr 11, 2013 9:11 PM

Hi,

TestAdvantage ver 2010.3,

Following code is not working

‘Get the list of items in the toolbar
tlbContent = SwfWindow(“Microsoft TaskVision 1.1”).SwfToolBar(“tbrTop”).GetContent

‘no. of Items in toolbar

cItems = SwfWindow(“Form1”).SwfToolBar(“Formatting”).GetItemsCount
SwfWindow(“Form1”).SwfToolBar(“Formatting”).GetItem(index)

Also not able to find out one of the toolbar button ENABLED or DISABLED property value with GetItemProperty.

As Button click Record-Playback code gives this for Toolbar

PerformToolAction tbmgrToolbar, tbmgrClick,tblbarname , btnName

There should be equivalent code for operations – GetItem(), GetItemsCount, GetContent, GetItemProperty

Pl advice on this.

Thanks,

~Laxmikant.

 

Sign In to post a reply

Replies

  • 0
    Michael S.
    Michael S. answered on Aug 24, 2011 8:49 PM

    Laxmikant,

    Here is an example of script that you can use with the methods that you mentioned.  You can run this script against the WinToolbarsBasicFeatures sample found in the samples that are installed with TestAdvantage.

    'Example of GetItem method
    Dim openItem
    openItem = SwfWindow("Infragistics UltraWinToolbars").SwfToolbar("_Form1_Toolbars_Dock_Area_Top").GetItem("Editors", 1)
    MSGBOX("GetItem:  " & openItem)
    
    'Example of GetItemsCount method
    Dim editorItemsCount
    editorItemsCount = SwfWindow("Infragistics UltraWinToolbars").SwfToolbar("_Form1_Toolbars_Dock_Area_Top").GetItemsCount("Editors")
    MSGBOX("GetItemsCount:  " & editorItemsCount)
    
    'Example of GetContent method
    Dim editorContent
    editorContent = SwfWindow("Infragistics UltraWinToolbars").SwfToolbar("_Form1_Toolbars_Dock_Area_Top").GetContent("Editors")
    MSGBOX("GetContent:  " & vbCrLf & editorContent)
    
    'Example of GetItemProperty
    Dim editorItemProperty
    editorItemProperty = SwfWindow("Infragistics UltraWinToolbars").SwfToolbar("_Form1_Toolbars_Dock_Area_Top").GetItemProperty("Editors", 1, "Enabled")
    MSGBOX("GetItemProperty:  "  & editorItemProperty)

     

     

    I hope you find this helpful.  Let me know if you have further questions.

    Michael S.

    • 0
      Michael S.
      Michael S. answered on Sep 1, 2011 10:34 PM

      Was the sample script helpful?  Let me know if I can be of further assistance.

      • 0
        Laxmikant
        Laxmikant answered on Sep 7, 2011 3:20 PM

        Thanks for this code. Still, not able to find out the solution.

        Keep you posted about updates.

         

      • 0
        Michael S.
        Michael S. answered on Sep 8, 2011 6:53 PM

        Laxmikant,

        Let me know what you find out.

      • 0
        Michael S.
        Michael S. answered on Sep 16, 2011 10:22 PM

        Do you have further questions?

      • 0
        Laxmikant
        Laxmikant answered on Sep 17, 2011 8:49 AM

        Thanks for your valuable support. There are no more question on this.

      • 0
        Anand
        Anand answered on Jan 5, 2012 7:05 AM

        You have passed "Editors" as argument for getitemscount(). What is that?

        What needs to pass? Is it the toolbar name that we got while recording???

      • 0
        Anand
        Anand answered on Jan 5, 2012 7:49 AM

        I am able to get the item from toolbar. How to select that item? which item property needs to be used?

      • 0
        Anand
        Anand answered on Mar 6, 2012 12:01 PM

        You have passed toolbar as "Editors"…What is that???

        What needs to passed at that position???

      • 0
        Michael S.
        Michael S. answered on Mar 6, 2012 3:17 PM

        "Editors" should be the key of the taskpane toolbar.

      • 0
        Dmitry
        Dmitry answered on Apr 10, 2012 11:10 AM

        Hello all,

        Could you please clarify, how can I use GatContent method to the child menue item?

        Please, refer below:

         

         

      • 0
        Michael S.
        Michael S. answered on Apr 24, 2012 7:57 PM

        The GetContent method takes a string for the key or a number for the index of a toolbar and returns the captions of the tools within the toolbar in a list that is delimited by a new line.  You seem to want to access a tool on a child menu which is a popupmenutool and not a toolbar, so I don't think the GetContent method will work for you.  Please tell me exactly what you want to do with the child menu so that I can address your question.

      • 0
        Ravi Salunkhe
        Ravi Salunkhe answered on Apr 5, 2013 1:49 PM

        Hi Michael,

        I'm not able to find the valid key from the toolbar, could you please help me out with it.

        SwfWindow("window").SwfWindow("window").SwfObject("_TempBlotter_Toolbars_Dock_Ar").GetItemsCount("Refresh")…this throws an error saying "key not found".

        I'm using TestAdvantage 2006 CLR 2.X version 3….

        Regards,

        Ravi Salunkhe

      • 0
        Alan Halama
        Alan Halama answered on Apr 11, 2013 9:11 PM

        Ravi,

        I answered your question here.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Laxmikant
Favorites
0
Replies
14
Created On
Apr 11, 2013
Last Post
13 years ago

Suggested Discussions

Created by

Created on

Apr 11, 2013 9:11 PM

Last activity on

Feb 23, 2026 2:55 PM