Page 1 of 1

Change Property ??

Posted: Mon Dec 06, 2004 6:05 pm
by maze42
Is this the right way to change a property without user input(no button puched)? My local property is m_pValue and I want to change it from my digital Interface. The digital Interface sends a NotifySubscribedDevices() every time a digital input has change its status. This code works but it feels a bit odd to use the ChangeRequestCompleted() method this way. :roll:





BOOL CInputDevice::SubscriptionNotification( LPCTSTR szListName, LPCTSTR szFilter, CDataPack* pDataPack )

{

CPropertyValue* pNoValue = NULL;



if (strcmp(pDataPack->GetData( "ChannelName" ),m_pChannelName->GetPropertyValueAsString())==0)

{

pNoValue = m_pValue->CreatePropertyValue( pDataPack->GetData( "Value" ) );

}

if (pNoValue)

{

pNoValue->ChangeRequestCompleted();

delete pNoValue;

}

return( TRUE );

}

Posted: Mon Dec 06, 2004 6:38 pm
by ScottBot
That's the way. When creating the property internally like this, it may seem a little odd. It makes more sense in when you think of being able to optionally call ChangeRequestFailed() when the changes are coming from the user.