Skip to main content
Known Participant
January 14, 2008
Question

How to Capture Selection Change event in DropdownListWidget

  • January 14, 2008
  • 2 replies
  • 535 views
Hi All,
I have a dropdownListWidget on dialog.I want to Capture the event when the selection string is changed.
I tried this in different way but lost.

in DialogObserver:AutoAttach

AttachToWidget(kIDCProfileDropDownListWidgetID,IID_IBOOLDROPDOWNLISTSTRINGCHANGED, panelControlData);

and in dialog::Update
if (theSelectedWidget == kIDCProfileDropDownListWidgetID )
{

//my code
}

this is not hitting at this point when i am changing selection of dropdownlist:

Then i created a observer class for this drop down but not working

myobserver::update
if ((protocol == IID_IBOOLDROPDOWNLISTSTRINGCHANGED) && (theChange == kListSelectionChangedMessage) )
{
//my code
}

where i am wrong or i am using wrong interface? guide me.

Thanks,
This topic has been closed for replies.

2 replies

Known Participant
January 17, 2008
Thanks a lot for ur help.
Participating Frequently
January 15, 2008
Hi,<br /><br />usually I attach my DDLs to IID_ISTRINGLISTCONTROLDATA and just check the widget in the observers update-method:<br /><br />void MyObserver::AutoAttach()<br />{<br />InterfacePtr<IPanelControlData> panelControlData(this, UseDefaultIID());<br />IControlView* controlView = panelControlData->FindWidget(kMyListWidgetID);<br />InterfacePtr<ISubject> subject(controlView, UseDefaultIID());<br />subject->AttachObserver(this, IID_ISTRINGLISTCONTROLDATA);<br />}<br /><br />void MyObserver::Update<br />(<br /> const ClassID& theChange,<br /> ISubject* theSubject,<br /> const PMIID& protocol,<br /> void* changedBy<br />)<br />{<br />InterfacePtr<IControlView> controlView(theSubject, UseDefaultIID());<br />WidgetID widgetID = controlView->GetWidgetID();<br />if (widgetID.Get() == kMyListWidgetID)<br />//do something<br />}}<br /><br />This is from a panel with different attached widgets, if you have an observer directly on your DDL or on a dialog it might look slightly different. I've also stripped it of nil-pointer-checks for brevity.<br /><br />Good luck,<br /><br />Bernt