Skip to content

Instantly share code, notes, and snippets.

@bastien
Created July 26, 2011 14:05
Show Gist options
  • Save bastien/1106844 to your computer and use it in GitHub Desktop.
Save bastien/1106844 to your computer and use it in GitHub Desktop.
Failing to creating the dialog switcher
#include "VCPlugInHeaders.h"
// Interface includes:
#include "ISession.h"
#include "IApplication.h"
#include "IDialogMgr.h"
#include "IDialog.h"
#include "IDialogCreator.h"
#include "IK2ServiceProvider.h"
#include "IK2ServiceRegistry.h"
#include "IPanelControlData.h"
#include "ISelectableDialogSwitcher.h"
// General includes:
#include "CActionComponent.h"
#include "CAlert.h"
// Project includes:
#include "MGMImporterID.h"
// [...]
void MGMImporterActionComponent::DoBasicSelectableDialog()
{
do
{
InterfacePtr<IK2ServiceRegistry> sRegistry(GetExecutionContextSession(), UseDefaultIID());
if (sRegistry == nil)
break;
InterfacePtr<IK2ServiceProvider>
sdService(sRegistry->QueryServiceProviderByClassID(kSelectableDialogServiceImpl, kMGMDlgDialogBoss));
if (sdService == nil)
break;
InterfacePtr<IDialogCreator> dialogCreator(sdService, IID_IDIALOGCREATOR);
if (dialogCreator == nil)
break;
IDialog* dialog = dialogCreator->CreateDialog();
if (dialog == nil)
break;
InterfacePtr<IPanelControlData> panelData(dialog, UseDefaultIID());
if (panelData == nil)
break;
WidgetID widgetID= kMGMImporterDialogWidgetID;
IControlView* dialogView = panelData->FindWidget(widgetID);
if (dialogView == nil)
break;
InterfacePtr<ISelectableDialogSwitcher>
dialogSwitcher(dialogView, IID_ISELECTABLEDIALOGSWITCHER);
if (dialogSwitcher == nil)
{
// FAILING HERE !!
ASSERT_FAIL("MGMImporterActionComponent::DoBasicSelectableDialog: dialogSwitcher invalid");
break;
}
dialogSwitcher->SetDialogServiceID(kMGMDlgService);
dialog->Open();
}while(false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment