ITQuants blog

Fusion Invest v7: how to display the MFC resource IDD?

Dec 30

Written by:
12/30/2015 6:37 PM  RssIcon

When overloading Sophis dialogs with the toolkit, you need the Win32 resource IDD of the dialog in order to get the resource template somewhere in the Sophis dll's (in most cases in the SophisRiskEn.dll), and customize it by adding new controls. In previous versions of Sophis, there was an option that permitted to display this IDD, by right double-clicking on the Sophis logo in the About box, and, after, by right clicking in the dialog.

Right-clicking it in the v7 About box does not enable it anymore, even if this option is still usefull. Looking at the code of the dialog, I've found finally the way to display it. The goal of this post is to share it.

In fact, taking a look at the code provided in the low level toolkit, I've found a very old class, developped by Roland Van Leeuwen, and ported from Mac to MFC by myself in 1998 (yes, about 17 years ago...). This class is named CSWindInterface, and you can find the declaration of this class in the SphLLInc\interface\WindInterface.h headerIt uses the singleton design pattern and there is only one instance in the program. If you take a look the methods declared in this header, you will find a SetShowDlgIDD method that will surely enable the display of the IDD.

At this step of analysis, we just need to test it by declaring a Sophis scenario that will permit to enable/disable the flag and will call this method. The following code declares such a class:

 

#include
//}}SOPHIS_TOOLKIT_INCLUDE
 
 
class ITQScenario_DisplayIDD : public CSRScenario
{
    DECLARATION_SCENARIO(ITQScenario_DisplayIDD)
 
// Overload of CSRScenario class
    virtual void Run()
    {
        bool static _enable = false;
        _enable = !_enable;
        sophis::gui::CSWindInterface::GetInterface().SetShowDlgIDD(_enable);
    }
    virtual eProcessingType GetProcessingType() const { return pUserPreference; }
};
 
CONSTRUCTOR_SCENARIO(ITQScenario_DisplayIDD)

 

 In the UNIVERSAL_MAIN of the toolkit dll, we just need to declare the menu item that should be displayed:

INITIALISE_SCENARIO(ITQScenario_DisplayIDD, "_DisplayIDD");

 

Launching SophisRisque or Value, and by clicking on _DisplayIDD, you will enable/disable the option as below:

 

Tags: IDD , MFC , Sophis , ITQuant
Categories: Sophis, C++

Search blog