Forum rules DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
I am trying to add my own page of preferences to the existing preferences dialog. Is this possible?
So far I have been able to trap the beginPropDialog event when the dialog opens and get the IUIX_PropSheets interface. I can remove pages but have not been able to successfully insert a page. I tried using this method of creating the object params and then object, and casting it to IUIX_PropSheetPage but get an error that "The parameter is incorrect" when creating the object. See sample code below:
This is not a trivial task at all. To implement this functionality you must first create a class derived from the IUIX_PropSheetPage and implement it functionality.
Basically the CreateNewUI method does the dialog's object creation part.:
HRESULT CreateNewUI(IUIX_PropSheets* pHost, IUIX_Obj* pParent, RECT* pPos, IUIX_Obj*& pNewUI)
{
pNewUI = nullptr;
UIX_CreateObjParams cp = { 0 };
cp.nStdClass = UIX_StdClass_Dialog;
cp.pParent = pParent;
cp.pImpl = m_pParentDlg; //This is a class that implements the IUIX_Dialog interface by the XML scheme
cp.nObjStyle = UIX_ObjStyle_Transparent | UIX_ObjStyle_TabStop;
cp.nCreateFlags = UIX_CreateObj_Hidden;
cp.pID = L"MyNewDialogID";
cp.pDlgTemplates = (LPSTR)m_sXML.c_str(); //The XML should hold the dialog control placement like one you can find in the DlgTemplates.xml in the Resources.dat file
cp.cbDlgTemplates = (LONG)m_sXML.size();
t_pUIObj obj;
HRESULT hr = m_uixInst->CreateObj(&cp, &obj);
if (FAILED(hr))
return hr;
pNewUI = obj;
pNewUI->AddRef();
return S_OK;
}
Also, the class, that is derived from the IUIX_Dialog should be implemented and it will do all of the logic for your controls that are being defined in the XML.
I managed to get my custom dialog page inserted into the preferences dialog using the CreateNewUI method in my derived IUIX_PropSheetPage class. Thank you for your assistance there. I however lose functionality on the preferences dialog. Seems like the normal dialog events aren't being handled so clicking on buttons OK, Apply, Cancel or close dialog do nothing. Am I supposed to implement a custom event handler for the entire preference dialog or did I perhaps implement something incorrectly? Any suggestions would be greatly appreciated.
Glad that you have found a solution by yourself. Wanted to ask you for a sample for investigation but yeah, you can change that behavior with that variable.
Do you have an example to add a custom settings section to pxvInst.Settings? I can retrieve settings but can't get my own section added to save my custom preferences. I tried using pxvInst.Settings.Add() but always get an error that the parameter is incorrect, whether passing a parameter or no parameter. Any guidance would be greatly appreciated.
While you cannot modify the Settings dictionary itself, you can modify the PluginsData sub-dictionary, as it's created for such cases. The only rule is to provide your own unique GUID first:
The ICabNode::Insert should be used for the dictionary types and the ICabNode::Add should be used if your node is an array and you want to add elements to it.
I have another question I hope you can assist with. In my derived IUIX_Dialog class I am trying to get the state of one of my checkboxes in the GetItemCheckState method. I can get the IUIX_Obj for the checkbox but not sure how to proceed from there. There is no checkbox object to cast it to that I can see. Can you point me in the right direction please?