Property readonly
Posted: Sun Nov 30, 2008 6:11 am
How to prohibit editing of property by the user in Device Plugin?
Home Automation for the Automation Enthusiast
https://housebot.com/forums/
Code: Select all
CHardwareInstance::SetPropertyLimits( const char* szPropertyName, int nLowLimit, int nHighLimit )
You're right. Sorry I was confused.DsA wrote:It in Hardware Interface Plugin. I have not found the same function in Device Plugin?
Code: Select all
// First attempt to register the Property (wizard version of registration that has prompt)
if (!m_CallBackInfo.pHB_RegisterDevicePropertyUsingWizard( m_CallBackInfo.m_hModuleHandle,
nDeviceNumber,
"Insteon Group",
"Group", FALSE,
"1",
ioInputAndOutput,
TRUE,
TRUE,
FALSE,
FALSE,
"Enter the group number" ))
{
// The registration failed. This is probably because this is the first time the property is being registered.
// Attempt to create the new "Insteon Group" Property.
if (!m_CallBackInfo.pHB_CreateDeviceProperty( "Insteon Group", "Group", ptNumeric ))
return( FALSE );
// The Property created successfully. We can optionally add values to the Property.
// This example creates numeric values from 1 to 256
m_CallBackInfo.pHB_CreateDevicePropertyValue( "Insteon Group", "[1 - 256]" );
// If not adding a sequential numeric range like above, call pHB_CreateDevicePropertyValue() for
// each value to be added to the Property.
// m_CallBackInfo.pHB_CreateDevicePropertyValue( "Insteon Group", "1" );
// m_CallBackInfo.pHB_CreateDevicePropertyValue( "Insteon Group", "2" );
// m_CallBackInfo.pHB_CreateDevicePropertyValue( "Insteon Group", "3" );
// Now that the Property has been created, we can try and register it again (same call as at the top)
if (!m_CallBackInfo.pHB_RegisterDevicePropertyUsingWizard( m_CallBackInfo.m_hModuleHandle,
nDeviceNumber,
"Insteon Group",
"Group",
FALSE,
"1",
ioInputAndOutput,
TRUE,
TRUE,
FALSE,
FALSE,
"Enter the group number" ))
return( FALSE );
}