SQABasic "ListBoxFunctions" Library

 MODULE DESCRIPTION:

      Routines and utilities to work on SQA Type=LISTBOX objects in
      Data-Driven Automation.

 SUPPORTED ACTION COMMANDS:

      SelectTextItem          'Select a Text Item (Single Click)
      SelectAnotherTextItem   'Select another Text Item (Single Ctrl+Click)
      ActivateTextItem        'Activate a Text Item (Double Click)
      SelectPartialMatch      'Select an Item by partial Text match (Single Click)
      ActivatePartialMatch    'Activate an Item by partial Text match (Double Click)

      SelectUnverifiedTextItem        'Select a Text Item (Single Click--No post-Verification)
      SelectAnotherUnverifiedTextItem 'Select another Text Item (Single Ctrl+Click--No post-Verification)
      ActivateUnverifiedTextItem      'Activate a Text Item (Double Click--No post-Verification)
      SelectUnverifiedPartialMatch    'Select an Item by partial Text match (Single Click--No post-Verification)
      ActivateUnverifiedPartialMatch  'Activate an Item by partial Text match (Double Click--No post-Verification)

      VerifySelectedItem      'verify the text item is selected
      VerifyItemUnselected    'verify the text item IS NOT selected
      VerifySelectedPartialMatch 'verify the item is selected based on a partial match.

      VerifyListContains          'Verify that a list contains a particular item.
      VerifyListDoesNotContain    'Verify that a list does NOT contain a particular item.
      VerifyListContainsPartialMatch        'Verify that a list contains a particular item substring.
      VerifyListDoesNotContainPartialMatch  'Verify that a list does NOT contain a particular item substring.

 Orig Author: Carl Nagle
 Orig   Date: APR 04, 2000
 History:

      APR 04, 2000    Original Release
      APR 27, 2000    (CANAGL) Enabled optional quoted text
      FEB 12, 2002    (DCOEN) Added html tag handling for
                                  GetListBoxTextIndex and
                                  VerifyTextItemSelection functions
      MAY 06, 2002    (CANAGL) Added partial text match ability.
      JUN 04, 2002    (CANAGL) Fixed certain partial text match problems.
      JUN 05, 2002    (BWEBER) Added some support for Java.
      JUN 07, 2002    (CANAGL) Added UNVERIFIED commands to disable post-Verification.
                               Also consolidated routines to reduce duplication.
      OCT 17, 2002    (CANAGL) Reroute fallback to GenericObjectFunctions.
      OCT 22, 2002    (CANAGL) Warn of unimplemented TF and TW record types.
      OCT 24, 2002    (ASPOTT\CANAGL) Enhanced ConvertHTMLEntities usage.
      OCT 25, 2002    (CANAGL) Moved generic HTML ListBox support to HTMLFunctions.
      DEC 12, 2002    (CANAGL) Added support for XSLComponentActions.MAP
      JAN 30, 2003    (YWANG)  Modified SelectTextItem to cope with VB item longer than 100 chars.
                               Fixed conflicts between "Unverified" and "PartialMatch"
      NOV 18, 2003    (CANAGL) Added support for Activate on Java ListBox and fixed
                               an "out of range" box on listitem indices.
      DEC 09, 2003    (MEVENK) Added SelectAnotherTextItem Command
                               Added SelectAnotherUnverifiedTextItem command.
      DEC 09, 2003    (CANAGL) Catching "Out of Range" errors when no data is available
      APR 05, 2004    (JCRUNK) Added VerifyListContains and VerifyListDoesNotContain Commands
      AUG 04, 2004    (CANAGL) SkipVerify on SelectAnotherTextItem for HTML.
      OCT 28, 2004    (CANAGL) Added VerifyListContainsPartialMatch and VerifyListDoesNotContainPartialMatch
      OCT 13, 2005    (DCOEN)  Modified VerifyListDoesNotContain to Pass on a 0-sized ListBox

 Copyright (C) SAS Institute Inc. All rights reserved.
 GNU General Public License: http://www.opensource.org/licenses/gpl-license.php
Declarations Constants Global Variables User-Defined Types Routine Details

User Dependencies:

(stuff the developer's library/script $INCLUDES at compile time.)
(Note: The order of items may matter and may be different for your code.)

Internal Dependencies:

(stuff this library needs at compile time.)

Exported Declarations

Function GetListBoxIndexText     BasicLib ListBoxFunctions 
Function GetListBoxTextIndex     BasicLib ListBoxFunctions 
Function GetListBoxSelection     BasicLib ListBoxFunctions 
Function VerifyListBoxTextSelection  BasicLib ListBoxFunctions 

Routine Details



   Sub VerifySelectedItem (Optional match, Optional unselected)


 DESCRIPTION:

      Routine to verify a particular text item is selected.

      The routine expects that the given object already has Context or Focus.
      It also expects that Global StepDriverTestInfo contains all the information
      it needs to perform its function.

 DATA TABLE PARAMETERS:

      FLD     CONTENT
      ---     ------------------------------
       5      Case-sensitive text of node to verify as selected.

 INTERNAL USE SUBROUTINE PARAMETERS (subject to change at a whim):

      match       Optional parameter to enable partial matches (match=1).
                  This is for the PartialMatch set of commands.

      unselected  Optional parameter to test that an item is NOT selected (unselected=1).
                  This is for the Unselected set of commands.

 ERRORS:

      none

 Orig Author: Carl Nagle
 Orig   Date: APR 04, 2000
 History:

      APR 04, 2000    Original Release
      APR 27, 2000    (CANAGL) Enabled optional quoted text
      MAY 06, 2002    (CANAGL) Added partial text match ability.
      JUN 07, 2002    (CANAGL) Added unselected option to reduce duplicate code.




   Sub VerifyItemUnselected


 DESCRIPTION:

      Routine to verify a particular text item is NOT SELECTED.

      The routine expects that the given object already has Context or Focus.
      It also expects that Global StepDriverTestInfo contains all the information
      it needs to perform its function.

 DATA TABLE PARAMETERS:

      FLD     CONTENT
      ---     ------------------------------
       5      Case-sensitive text of node to verify as NOT selected.

 ERRORS:

      none

 Orig Author: Carl Nagle
 Orig   Date: APR 04, 2000
 History:

      APR 04, 2000    Original Release
      APR 27, 2000    (CANAGL) Enabled optional quoted text
      MAY 06, 2002    (CANAGL) Added partial text match ability.
      JUN 07, 2002    (CANAGL) Merged into VerifySelectedItem.




   Sub SelectTextItem (Optional activate, Optional match, Optional skipVerify)



 DESCRIPTION:

      Routine to Click an item according to its text value.  After the selection
      we attempt to verify that the item is actually selected.

      The routine expects that the given object already has Context or Focus.
      It also expects that Global StepDriverTestInfo contains all the information
      it needs to perform its function.

 DATA TABLE PARAMETERS:

      FLD     CONTENT
      ---     ------------------------------
       5      Case-sensitive text of node to select and verify selection.

 INTERNAL USE SUBROUTINE PARAMETERS (subject to change at a whim):

      activate    Optional parameter to DblClick (activate=1) instead of single click.
                  This is for the Activate set of commands.

      match       Optional parameter to enable partial matches (match=1).
                  This is for the PartialMatch set of commands.

      skipVerify  Optional parameter to disable (skipVerify=1) post-selection verifications.
                  This is for the Unverified set of commands.

 ERRORS:

      none

 Orig Author: Carl Nagle
 Orig   Date: APR 04, 2000
 History:

      APR 04, 2000    Original Release
      APR 27, 2000    (CANAGL) Enabled optional quoted text
      MAY 06, 2002    (CANAGL) Added partial text match ability.
      JUN 04, 2002    (CANAGL) Fixed certain partial text match problems.
      JUN 07, 2002    (CANAGL) Added activate to reduce duplicate code.
                               Added skipVerify option to disable post-Verification.
      JAN 15, 2003    (CANAGL) SkipVerify will not fail if list cannot be
                               retrieved prior to selection.
      JAN 29, 2003    (YWANG)  Modified to cope with long item text.
                               Fixed conflicts between "Unverified" and "PartialMatch"
      NOV 18, 2003    (CANAGL) Added support for Activate on Java ListBox.




   Sub SelectUnverifiedTextItem



 DESCRIPTION:

      Routine to Click an item according to its text value.
      No check is performed after the selection to verify success.
      This is typically done for cases when the listbox is only temporary
      in nature and disappears immediately upon a selection.

      The routine expects that the given object already has Context or Focus.
      It also expects that Global StepDriverTestInfo contains all the information
      it needs to perform its function.

 DATA TABLE PARAMETERS:

      FLD     CONTENT
      ---     ------------------------------
       5      Case-sensitive text of node to select.

 ERRORS:

      none

 Orig Author: Carl Nagle
 Orig   Date: JUN 07, 2002
 History:

      JUN 07, 2002    Original Release




   Sub ActivateTextItem


 DESCRIPTION:

      Routine to activate (double click) an item according to its text value.
      After the selection we attempt to verify that the item is actually selected.

      The routine expects that the given object already has Context or Focus.
      It also expects that Global StepDriverTestInfo contains all the information
      it needs to perform its function.

 DATA TABLE PARAMETERS:

      FLD     CONTENT
      ---     ------------------------------
       5      Case-sensitive text of node to DblClick and verify.

 ERRORS:

      none

 Orig Author: Carl Nagle
 Orig   Date: APR 04, 2000
 History:

      APR 04, 2000    Original Release
      APR 27, 2000    (CANAGL) Enabled optional quoted text
      MAY 06, 2002    (CANAGL) Added partial text match ability.
      JUN 04, 2002    (CANAGL) Fixed certain partial text match problems.
      JUN 07, 2002    (CANAGL) Merged with SelectTextItem.




   Sub ActivateUnverifiedTextItem


 DESCRIPTION:

      Routine to DblClick an item according to its text value.
      No check is performed after the selection to verify success.
      This is typically done for cases when the listbox is only temporary
      in nature and disappears immediately upon a selection.

      The routine expects that the given object already has Context or Focus.
      It also expects that Global StepDriverTestInfo contains all the information
      it needs to perform its function.

 DATA TABLE PARAMETERS:

      FLD     CONTENT
      ---     ------------------------------
       5      Case-sensitive text of node to DblClick.

 ERRORS:

      none

 Orig Author: Carl Nagle
 Orig   Date: JUN 07, 2002
 History:

      JUN 07, 2002    Original Release




   Sub SelectPartialMatch



 DESCRIPTION:

      Routine to Click and Verify selection of an item according to a partial text match.

      The routine expects that the given object already has Context or Focus.
      It also expects that Global StepDriverTestInfo contains all the information
      it needs to perform its function.

 DATA TABLE PARAMETERS:

      FLD     CONTENT
      ---     ------------------------------
       5      Case-sensitive substring of node to select and verify.

 ERRORS:

      none

 Orig Author: Carl Nagle
 Orig   Date: MAY 06, 2002
 History:

      MAY 06, 2002    Original Release
      JUN 07, 2002    (CANAGL) Merged with SelectTextItem.




   Sub SelectUnverifiedPartialMatch


 DESCRIPTION:

      Routine to Click an item according to a partial text match.
      No post-select verification of the selection is performed.
      This is typically done for cases when the listbox is only temporary
      in nature and disappears immediately upon a selection.

      The routine expects that the given object already has Context or Focus.
      It also expects that Global StepDriverTestInfo contains all the information
      it needs to perform its function.

 DATA TABLE PARAMETERS:

      FLD     CONTENT
      ---     ------------------------------
       5      Case-sensitive substring of node to select.

 ERRORS:

      none

 Orig Author: Carl Nagle
 Orig   Date: JUN 07, 2002
 History:

      JUN 07, 2002    Original Release




   Sub ActivatePartialMatch ()


 DESCRIPTION:

      Routine to DblClick an item according to a partial text match.
      After the selection the item is verified as being selected.

      The routine expects that the given object already has Context or Focus.
      It also expects that Global StepDriverTestInfo contains all the information
      it needs to perform its function.

 DATA TABLE PARAMETERS:

      FLD     CONTENT
      ---     ------------------------------
       5      Case-sensitive substring of node to select and verify.

 ERRORS:

      none

 Orig Author: Carl Nagle
 Orig   Date: MAY 06, 2002
 History:

      MAY 06, 2002    Original Release
      JUN 07, 2002    (CANAGL) Merged with SelectTextItem.




   Sub ActivateUnverifiedPartialMatch ()


 DESCRIPTION:

      Routine to DblClick an item according to a partial text match.
      No check is done after the selection to verify success.  This is typically done
      when the ListBox is only temporary in nature and disappears immediately after a
      selection.

      The routine expects that the given object already has Context or Focus.
      It also expects that Global StepDriverTestInfo contains all the information
      it needs to perform its function.

 DATA TABLE PARAMETERS:

      FLD     CONTENT
      ---     ------------------------------
       5      Case-sensitive substring of node to DblClick.

 ERRORS:

      none

 Orig Author: Carl Nagle
 Orig   Date: JUN 07, 2002
 History:

      JUN 07, 2006    Original Release




   Sub VerifySelectedPartialMatch


 DESCRIPTION:

      Routine to verify a particular text item is selected based on a partial text match.

      The routine expects that the given object already has Context or Focus.
      It also expects that Global StepDriverTestInfo contains all the information
      it needs to perform its function.

 DATA TABLE PARAMETERS:

      FLD     CONTENT
      ---     ------------------------------
       5      Case-sensitive substring of node to verify.

 ERRORS:

      none

 Orig Author: Carl Nagle
 Orig   Date: MAY 06, 2002
 History:

      MAY 06, 2002    Original Release
      JUN 07, 2002    (CANAGL) Merged with VerifySelectedItem.




   Sub SelectAnotherTextItem (Optional match, Optional skipVerify)

 DESCRIPTION:

      Routine to Control+Click an item according to its text value. Routine
      is used when you want to select more that one item in a list Box at the same time.

      The routine expects that the given object already has Context or Focus.
      It also expects that Global StepDriverTestInfo contains all the information
      it needs to perform its function.

 DATA TABLE PARAMETERS:

      FLD     CONTENT
      ---     ------------------------------
       5      Case-sensitive text of node to select and verify selection.

 INTERNAL USE SUBROUTINE PARAMETERS (subject to change at a whim):

      match       Optional parameter to enable partial matches (match=1).
                  This is for the PartialMatch set of commands.

      skipVerify  Optional parameter to disable (skipVerify=1) post-selection verifications.
                  This is for the Unverified set of commands.

 ERRORS:

      none

 Orig Author: Meera Venkataramani
 Orig   Date: DEC 09, 2003
 History:

      DEC 09, 2003    Original Release
      AUG 04, 2004    (CANAGL) SkipVerify on SelectAnotherTextItem for HTML.




   Sub SelectAnotherUnverifiedTextItem (Optional match, Optional skipVerify)

 DESCRIPTION:

      Routine to Control+Click an item according to its text value. Routine is
      used when you want to select more than one item in a list Box at the same time.
      No post-select verification of the selection is performed.

      The routine expects that the given object already has Context or Focus.
      It also expects that Global StepDriverTestInfo contains all the information
      it needs to perform its function.

 DATA TABLE PARAMETERS:

      FLD     CONTENT
      ---     ------------------------------
       5      Case-sensitive text of node to select and verify selection.

 INTERNAL USE SUBROUTINE PARAMETERS (subject to change at a whim):


      match       Optional parameter to enable partial matches (match=1).
                  This is for the PartialMatch set of commands.

      skipVerify  Optional parameter to disable (skipVerify=1) post-selection verifications.
                  This is for the Unverified set of commands.

 ERRORS:

      none

 Orig Author: Meera Venkataramani
 Orig   Date: DEC 09, 2003
 History:

      DEC 09, 2003    Original Release



   Sub VerifyListContains(Optional mode, Optional fuzzy)

 DESCRIPTION:

      Routine to Verify that a Certain item exists (or doesn't) in a listbox.
      This routine satisfies:

          VerifyListContains
          VerifyListDoesNotContain
          VerifyListContainsPartialMatch
          VerifyListDoesNotContainPartialMatch

 PARAMETERS:

      mode   0=Contains
             1=DoesNotContain

      fuzzy  0=full string
             1=partial match

 DATA TABLE PARAMETERS:

      FLD     CONTENT
      ---     ------------------------------
       5      Text to look for in the Listbox object
       6      Optional flag for CaseSensitive verification valid values are
              "True" and "CASE-SENSITIVE".
              The default is false or NOT case-sensitive

 ERRORS:

      none

 Orig Author: John Crunk
 Orig   Date: APR 05, 2004
 History:

      APR 05, 2004    Original Release
      OCT 28, 2004    (CANAGL) Fixed untrapped errors.
                      Also combined with DoesNotContain and PartialMatch commands.
      OCT 13, 2005    (DCOEN)  Modified to Pass on a 0-sized ListBox




   Sub Main ()

 DESCRIPTION:

      Entry point to process a StepDriver ACTION COMMAND on a LISTBOX.
      The routine merely reads the Global StepDriverTestInfo.testcommand and
      calls the appropriate subroutine to process it.

      If the testcommand is unrecognized it will log a WARNING_MESSAGE and
      exit with a WARNING status.

 DATA TABLE PARAMETERS:

      none    -   the called subroutine has the requirements

 ERRORS:

      none

 Orig Author: Carl Nagle
 Orig   Date: APR 04, 2000
 History:

      APR 04, 2000    Original Release
      MAY 06, 2002    (CANAGL) Added partial text match ability.
      JUN 07, 2002    (CANAGL) Added UNVERIFIED commands to disable post-Verification.
                               Also consolidated routines to reduce duplication.
      OCT 17, 2002    (CANAGL) Reroute fallback to GenericObjectFunctions.
      OCT 22, 2002    (CANAGL) Warn of unimplemented TF and TW record types.
      DEC 12, 2002    (CANAGL) Added support for XSLComponentActions.MAP
      DEC 09, 2003    (MEVENK) Added SelectAnotherTextItem command.
                               Added SelectAnotherUnverifiedTextItem command.
      APR 05, 2004    (JCRUNK) Added VerifyListContains and VerifyListDoesNotContain
      OCT 28, 2004    (CANAGL) Added VerifyListContainsPartialMatch and VerifyListDoesNotContainPartialMatch


Copyright (C) SAS Institute
GNU General Public License: http://www.opensource.org/licenses/gpl-license.php 
==============================================================================