[CONNECT Update 14 C++] using VisualStudio 2017 mdlDialog_publishComplexVariable won't publish.

I have my structure in my .h file, I publish my complex variables in my CPP file but the structName and the variableName turn red and I get the message const char is incompatible with char.

my struct in my .h file is as so.

typedef struct olddata
{
	int		oldmslink;
	int		oldtextx;
	int		oldtexty;
	int		oldcontractors;
	long 	openmslink;
	WChar	olddeptName[60];
	WChar	oldisContractor[4];
	WChar	oldtablename[9];
	WChar	olddepartment[10];
	WChar	oldlocation[10];
	WChar	oldemptype[10];
	WChar	olddcid[15];
	WChar	oldLastname[20];
	WChar	oldMIddleinitial[2];
	WChar	oldfirstname[20];
	WChar	olddept_no[6];
	WChar	oldlocation_no[6];
	WChar	oldtid[8];
	WChar	oldnic[10];
	WChar	oldcims[10];
	WChar	oldemployee_type[4];
	WChar	oldphysical_location[41];
	WChar	oldphone_number[12];
	WChar	oldmanager_name[45];
	WChar	olddept_name[41];
	WChar	oldmanagernic[10];
	WChar	oldcubeNo[10];
	WChar	oldMInitial[2];
	WChar	oldFirstname[20];
	WChar	oldmydate[25];
	WChar	oldmslinkCH[12];
	WChar	oldCube[10];
	WChar	oldSuite[10];
	long	oldtextFileposition;
	long	oldshapeFileposition;
	long	oldcubeFileposition;

}oldData;

defined in my .CPP file as such

Public			oldData			OldData;

and published from my main prior to my dialog launch as:

mdlDialog_publishComplexVariable(setP, "olddata", "OldData", &OldData)

the 1st olddata in my example is underlined in red along with the second... when I mouse over them the popup error says argument of type "const char"" is incompatible with parameter of type "char*".

I cannot access any of my variables in my text items from my dialog box, though I can set the data in my dialog text boxes if I manually set the variable to text and synch.

Here is a list of my includes:

#include <stdio.h>
#include <string>  
#include <iostream> 
#include <sstream>
#include <Mstn\MdlApi\dbdefs.h>
#include <Mstn\MdlApi\dbdefs.r.h>
#include <DgnPlatform\DgnPlatform.h>
#include <DgnPlatform\ScanCriteria.h>
#include <Mstn\MdlApi\MdlApi.h>
#include <Mstn\MdlApi\mselems.h>
#include <Mstn\basetype.h>
#include <Mstn\MdlApi\dlogitem.h>
#include <Mstn\MdlApi\dlogids.r.h>
#include <Mstn\cmdlist.r.h>
#include <DgnPlatform\TextBlock\TextBlock.h>
#include <Mstn\MdlApi\TextBox.h>
#include <DgnPlatform\TextHandlers.h>
#include <clocale>
#include <Mstn\ISessionMgr.h>
#include <DgnPlatform\ITextEdit.h>
#include <DgnPlatform\DgnModelRef.h>
#include <DgnView\AccuDraw.h>
#include <DgnView\DgnElementSetTool.h>
#include <DgnPlatform\TextHandlers.h>
#include <Mstn\cmdlist.r.h>
#include <Mstn\MdlApi\cmdclass.r.h>
#include <Mstn\MdlApi\rscdefs.r.h>
#include <Mstn\MdlApi\MdlApi.h>
#include <Mstn\cmdlist.r.h>
#include <Mstn\MdlApi\rtypes.r.h>
#include <RmgrTools\Tools\msstrlst.h>
#include <Mstn\MdlApi\asynch.h>
#include <Bentley\Tasks\AsyncTask.h>
#include <Mstn\MicroStation.r.h>

I've spent two days on trying to figure this out... I've checked all the examples and have found nothing missing in my steps.

Any ideas?

Thanks,

John

  • I pasted your code into my test project and it works well.

    1. Do you create setP correctly first?

    SymbolSet* setP = mdlCExpression_initializeSet(VISIBILITY_DIALOG_BOX, 0, false);;
    mdlDialog_publishComplexVariable(setP, "olddata", "OldData", &OldData);

    2. My include and namespace parts are as below.

    [NOTE]: I place my own include file (here, its name is MyFile.h) at the end of MS SDK include files. That makes WChar definition can be recognized.

    #include <Bentley\Bentley.h>
    #include <DgnPlatform\DgnPlatformApi.h>
    #include <Mstn\MdlApi\MdlApi.h>
    #include <Mstn\ISessionMgr.h>
    #include "MyFile.h"  // I copy your typedef in this file
    
    using namespace std;
    USING_NAMESPACE_BENTLEY
    USING_NAMESPACE_BENTLEY_DGNPLATFORM
    USING_NAMESPACE_BENTLEY_MSTNPLATFORM
    USING_NAMESPACE_BENTLEY_MSTNPLATFORM_ELEMENT



  • Hello, yes I have the same #include files in my application and the namespaces.  If I include the "using namespace std" all my struct variables become errors in my file.  I am thinking this is a problem related to my Visual Studio 2017 rather than an MDL problem.

    I have typecasted my mdlDialog_publishComplexVariable(setP, (char*)"olddata", (char*)"oldData", &oldData);
    and mdlDialog_publishComplexVariable(setP, (char*)"namesdata", (char*)"data", &data);

    This makes the IDE accept this without errors, but it still isn't publishing the variables.

    my application actually compiles with no errors now, I created a simple button to get the values of my textbox but there is no data in the variable.

    DItem_TextRsc TEXTID_searchlastname=
     {
     NOCMD, LCMD, SYNONYMID_Names, NOHELP, MHELP, NOHOOK, NOARG,
     10, "%s", "%s", "", "", NOMASK, NOCONCAT, "Lastname","data.lastname"
      };

    I key in the data for the textbox, hit my button to get the value of data.lastname and there is nothing there.

  • I have my structure in my .h file

    It looks like you have taken half of the necessary steps.  For the MicroStation Dialog Manager to understand your app's complex variables, you must...

    1. Define a struct
    2. Create a type resource from your struct
    3. Publish that resource at compile time
    4. Publish that struct at run-time

    From what you've told us, you have completed 1 and 4, but we see no evidence for 2 and 3.

    You must have an .mt file so that Dialog Manager can interpret your variables at run-time.  You need to create a type resource from your .mt file.  Look in the SDK examples (e.g. BasicDialog) to find one, and look in the corresponding bmake file to see the rule that performs that compilation.  The type resource must be included in the list of the app's resources, and the example bmake files show how that is done.

    The  .mt file is trivial and contains something like this...

    #include "YourHeader.h" // where the struct is defined
    publishStructures (tag_yourStruct);
    

     
    Regards, Jon Summers
    LA Solutions

  • Hello Jon,

    I indeed do have these files included, I'm going insane trying to figure this out!

    $(genSrc)movedatacmd.h	: $(BaseDir)movedatacmd.r
    
    $(o)movedatacmd.rsc	: $(BaseDir)movedatacmd.r 
    
    #---------------------------------------------
    #	Create & compile the application's type resource file using rsctype
    #	 and rcomp
    #---------------------------------------------
    $(o)movedatatyp.r    	: $(BaseDir)movedatatyp.mt $(BaseDir)movedata.h
    
    $(o)movedatatyp.rsc    	: $(o)movedatatyp.r $(BaseDir)movedata.h

    /*movedatatyp.mt*/
    #include    "movedata.h"
    
    publishStructures (olddata);
    publishStructures (namesdata);

    I'm not great on interpreting the output from the compile results, But I don't see any errors at compile time so I assume all is well.  Output for my type rsc.

    [== Building C:\Users\NITM_D~1\AppData\Local\Temp\Bentley\MicroStationSDK\reqdobjs\movedata.mi, (C:\Users\NITM_D~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\movedatatyp.rsc) ==]
    rlib @C:\Users\NITM_D~1\AppData\Local\Temp\Bentley\MicroStationSDK\objects\make.opt
    MicroStation Resource Librarian 03.18.02

  • Please post your app.mke file.

     
    Regards, Jon Summers
    LA Solutions

  • Here it is... I actually hope there is something missing so I can get this behind me!

    Thanks Jon

    PolicyFile = MicroStationPolicy.mki
    DEFAULT_TARGET_PROCESSOR_ARCHITECTURE=x64
    MDLMKI = $(MSMDE)mki/
    mdlLibs = $(MSMDE)library/
    dirToSearch = $(MDLMKI)
    genSrc = $(o)
    %include $(MDLMKI)mdl.mki
    %include $(MDLMKI)cincapnd.mki
    
    appName  = movedata
    sAppName = movedata
    
    #---------------------------------------------
    # Define macros specific to this example
    #---------------------------------------------
    privateInc      = $(baseDir)
    langSpec        = $(baseDir)transkit/
    
    
    #----------------------------------------------------------
    # Create needed output directories in case they don't exist
    #----------------------------------------------------------
    always:
        !~@mkdir $(o)
        !~@mkdir $(rscObjects)
        !~@mkdir $(reqdObjs)
    
    #----------------------------------------------------------------------
    # Define macros for files included in our link and resource merge
    #----------------------------------------------------------------------
    movedataObjs = \
        $(o)movedata.mo \
        $(mdlLibs)ditemlib.dlo
    
    movedataRscs = \
        $(o)movedatacmd.rsc \
        $(o)movedatatyp.rsc
    
    #---------------------------------------------
    #	Generate command table include & resource file using rcomp
    #---------------------------------------------
    
    $(genSrc)movedatacmd.h	: $(BaseDir)movedatacmd.r
    
    $(o)movedatacmd.rsc	: $(BaseDir)movedatacmd.r 
    
    #---------------------------------------------
    #	Create & compile the application's type resource file using rsctype
    #	 and rcomp
    #---------------------------------------------
    $(o)movedatatyp.r    	: $(BaseDir)movedatatyp.mt $(BaseDir)movedata.h
    
    $(o)movedatatyp.rsc    	: $(o)movedatatyp.r $(BaseDir)movedata.h
    
    #------------------------------------------------
    #   Set up to use dlmcomp.mki and dlmlink.mki
    #------------------------------------------------
    dlmObjs = \
        $(o)$(appName)$(oext) 
     
    DLM_NAME                = $(appName)
    DLM_DEST                = $(mdlapps)
    DLM_OBJECT_FILES        = $(dlmObjs)
    DLM_OBJECT_DEST         = $(o)
    DLM_SPECIAL_LINKOPT     = -fixed:no     # Notify linker this library does not require a fixed base address to load
    DLM_NO_DLS              = 1             # USE DLLEXPORT IN .CPP
    DLM_NO_DEF              = 1
    DLM_NOENTRY             = 1
    DLM_NO_MANIFEST         = 1             # If not set linker embeds your current (developer) patched MSVCRT version manifest in output dll.  This is not desirable and produces side-by-side CLIENT ERROR: 14001)
    DLM_NO_SIGN             = 1             # If not set and no certificate found, ERROR: 'singleton' is not recognized as an internal or external command
    
    LINKER_LIBRARIES = $(mdlLibs)BentleyAllocator.lib \
    						  $(mdlLibs)RmgrTools.lib\
    						  $(mdlLibs)DgnPlatform.lib\
    
    #----------------------------------------------------------------------
    #   Compile the source files for the DLM
    #----------------------------------------------------------------------
    
    $(o)$(appName)$(oext)		: $(baseDir)$(appName).cpp 
    
    %include $(MDLMKI)dlmlink.mki
    
    #---------------------------------------------
    #	Merge the dialog resources & MDL program file using rlib
    #---------------------------------------------
    $(reqdObjs)movedata.mi    	: $(movedataRscs)
    	$(msg)
    	> $(o)make.opt
    	-o$@
    	$(movedataRscs)
    	<
    	$(RLibCmd) @$(o)make.opt
    	~time
    
    # complete construction of the .ma by getting the last resource.
    
    %include $(BaseDir)movedatarsc.mki
    
    #----------------------------------------------------------------------
    # Link the MA
    #----------------------------------------------------------------------
    # mdlApps = c:/john/movedata/movedata
    MA_NAME         = $(appName)
    RIGHTSCOMPLIANT = false
    MA_DEST         = $(mdlApps)
    MA_RSC_FILES    = $(rscObjects)$(sAppName)cmd.rsc
    MA_NO_VERSION   = 1
    
    

  • Although it's nothing to do with your problem, these lines are redundant...

    movedataObjs = \
        $(o)movedata.mo \
        $(mdlLibs)ditemlib.dlo
    

    Those concern the MDL compiler and linker, which are not used in CONNECT.

    Your make file doesn't build a dialog resource.

     
    Regards, Jon Summers
    LA Solutions

  • Lol, not knowing ANYTHING about .mke files, am I to understand that is the reason the complex variables are not working in my dialog box?  No dialog resource?  If so...what do I need to add to my .mke file to get this going?

    Do you have info on .mke files since they are essential to compiling our applications?  I only edit what I think is closest to what my application needs and hope for the best.

  • am I to understand that is the reason the complex variables are not working in my dialog box?  No dialog resource?

    Where did your dialog box come from if it's not built by your app's bmake file?

    Do you have info on .mke files since they are essential to compiling our applications?

    The best references are the bmake files provided for the SDK examples.

    bmake is based on the ancient make technology.  There's a book about Gnu Make.  However, the syntax is cryptic and is confused by the large number of include (*.mki) files and that all variables (macros) are global.

     
    Regards, Jon Summers
    LA Solutions

  • Thanks for the link Jon, it contains a lot of useful information.