Loading ...
Sorry, an error occurred while loading the content.

SelComboItem command won't trigger CBN_SELCHANGE Notification

Expand Messages
  • wenjie wang
    I m having problem with the manipulation of combo item selection when sending raw message(CB_SETCURSEL) or using the new feature SelComboItem command added
    Message 1 of 3 , Apr 3, 2005
    • 0 Attachment
      I'm having problem with the manipulation of combo item selection when
      sending raw message(CB_SETCURSEL) or using the new
      feature "SelComboItem" command added in the release 1.50.3-ad. Both
      approaches don't behave the same as a real user selecting an item from
      a combo box.

      When a real user make a selection from the combo box, a notification
      (CBN_SELCHANGE) is sent, but the GUITEST32 will only make the change
      to the current selected item, but won't be triggering the windows
      notification message. I guess it works fine for most of the cases,
      except mine;-) I have more than one combo boxes, the contents of 2nd
      combo depending on the selected item of 1st combo. What I'm doing
      inside the application is to handle the CBN_SELCHANGE notification of
      1st combo and depending on what's being selected, I'll populate the
      contents of 2nd combo box. As the CBN_SELCHANGE is not sent, my
      application behaved different when using GUITEST and failed my test
      case;(

      Any suggestions?
    • pkaluski
      ... when ... Both ... from ... change ... 2nd ... of ... Hmm... Good point. It behaves as expected. CBN_SELCHANGE documentation on MSDN says that it is not
      Message 2 of 3 , Apr 4, 2005
      • 0 Attachment
        --- In perlguitest@yahoogroups.com, "wenjie wang" <wenjie.wang@d...>
        wrote:
        >
        >
        > I'm having problem with the manipulation of combo item selection
        when
        > sending raw message(CB_SETCURSEL) or using the new
        > feature "SelComboItem" command added in the release 1.50.3-ad.
        Both
        > approaches don't behave the same as a real user selecting an item
        from
        > a combo box.
        >
        > When a real user make a selection from the combo box, a notification
        > (CBN_SELCHANGE) is sent, but the GUITEST32 will only make the
        change
        > to the current selected item, but won't be triggering the windows
        > notification message. I guess it works fine for most of the cases,
        > except mine;-) I have more than one combo boxes, the contents of
        2nd
        > combo depending on the selected item of 1st combo. What I'm doing
        > inside the application is to handle the CBN_SELCHANGE notification
        of
        > 1st combo and depending on what's being selected, I'll populate the
        > contents of 2nd combo box. As the CBN_SELCHANGE is not sent, my
        > application behaved different when using GUITEST and failed my test
        > case;(
        >
        > Any suggestions?


        Hmm...
        Good point. It behaves as expected. CBN_SELCHANGE documentation on
        MSDN says that it is not triggered when CB_SETCURSEL is used.
        But during the human interaction with GUI application, in 99.99%
        CBN_SELCHANGE will be sent. This may lead to unexpected failures of
        automated tests.
        The workaround could be calling SelComboItem and then SendKeys
        ( "arrow up" "arrow down" ) (so the net effect is "no change").

        The issue should be logged in the bugs or issues database on
        project's site on the source forge. The best person to do it would be
        Wenjie (as a discoverer)

        -Piotr
      • pkaluski
        This should work (according to MSDN): DWORD SelComboString(hWnd, lpItem, start_idx = 0 ) HWND hWnd; char *lpItem; DWORD start_idx; CODE: int result = 0; result
        Message 3 of 3 , May 10 12:48 AM
        • 0 Attachment
          This should work (according to MSDN):


          DWORD
          SelComboString(hWnd, lpItem, start_idx = 0 )
          HWND hWnd;
          char *lpItem;
          DWORD start_idx;
          CODE:
          int result = 0;
          result = SendMessage(hWnd,
          CB_SELECTSTRING,
          start_idx,
          LPARAM( lpItem ) );
          if( result == CB_ERR ){
          RETVAL = -1;
          }else{
          RETVAL = result;
          }
          OUTPUT:
          RETVAL


          It is a wrapper around CB_SELECTSTRING.
          Let me know if it works.
          It works for me but it would be good to make sure that it really sends
          all expected notifications.

          -Piotr



          --- In perlguitest@yahoogroups.com, "wenjie wang" <wenjie.wang@d...>
          wrote:
          >
          >
          > I'm having problem with the manipulation of combo item selection when
          > sending raw message(CB_SETCURSEL) or using the new
          > feature "SelComboItem" command added in the release 1.50.3-ad. Both
          > approaches don't behave the same as a real user selecting an item from
          > a combo box.
          >
          > When a real user make a selection from the combo box, a notification
          > (CBN_SELCHANGE) is sent, but the GUITEST32 will only make the change
          > to the current selected item, but won't be triggering the windows
          > notification message. I guess it works fine for most of the cases,
          > except mine;-) I have more than one combo boxes, the contents of 2nd
          > combo depending on the selected item of 1st combo. What I'm doing
          > inside the application is to handle the CBN_SELCHANGE notification of
          > 1st combo and depending on what's being selected, I'll populate the
          > contents of 2nd combo box. As the CBN_SELCHANGE is not sent, my
          > application behaved different when using GUITEST and failed my test
          > case;(
          >
          > Any suggestions?
        Your message has been successfully submitted and would be delivered to recipients shortly.