how to show style dialog

877
5
05-19-2012 02:37 AM
AzimAzim
New Contributor
How to show style dialog for choose item on C++?

i found sample code C# :
axSymbologyControl1.LoadStyleFile(@"myInstallLocation\ArcGIS\Styles\ESRI.ServerStyle");

[ATTACH=CONFIG]14459[/ATTACH]

How to do form/control or show dialog for show and choose Item from style-file (\ESRI.ServerStyle) (C++) ?
0 Kudos
5 Replies
RichardWatson
Frequent Contributor
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//00160000040p000000

I guessing that what you are asking is how can you use ArcObjects in unmanaged C++.

All the ArcObject code is based on COM which C++ is able to call.  The way that you do that is to import the required type library, cocreate the COM object, and then use the various interfaces to call what you need.  If this is all new to you then I suggest that you go through the various samples provided.

Of course, if you are writing managed C++ then you should be able to follow the C# example after translating the syntax as required.

If your C++ skills are weak then you could also create a C# object which wrappers the ESRI objects and exposes to COM what you need in terms of an interface.  In other words, do all your heavy lifting in C#.
0 Kudos
AzimAzim
New Contributor
I want to write unmanaged C++ for Arcgis Engine.

My code for show SymbologyControl:

ISymbologyControlPtr pSym;
pSym.CreateInstance(CLSID_SymbologyControl);
pSym->LoadStyleFile((BSTR)L"C:\\Program Files\\ArcGIS\\Desktop10.0\\Styles\\ESRI_Optimized.ServerStyle" );
pSym->put_DisplayStyle(esriSymbologyDisplayStyle::esriDisplayStyleSmallIcon);

//pSym->AboutBox(); // properly shows About information.



Which method i must to use for show this damned control?

I would appreciate for any tips, about how to show on form (MFC, Qt, Atl).
0 Kudos
AzimAzim
New Contributor
I found method for show SymbologyControl.

 ISymbologyControlPtr pSym;
 pSym.CreateInstance(CLSID_SymbologyControl);
 IID pSymIID =pSym.GetIID();

 QAxWidget* symControlWidget = new QAxWidget();
 symControlWidget->setControl("{2ACEE55E-C5F5-483C-8B10-D2B25B81F46F}"); //GUID
 symControlWidget->queryInterface(QUuid(pSymIID), (void**)&pSym);
  
 pSym->put_ShowContextMenu(VARIANT_TRUE);
 
 QString styleFileName="C:\\Projects\\VSQTGUI\\Data\\ESRI_Optimized.ServerStyle";
 BSTR bstr_sfn=CComBSTR((const char*)styleFileName.toAscii());
 
 pSym->LoadStyleFile(bstr_sfn);
 
 
 layout->addWidget(symControlWidget);
 this->setLayout(layout);


But this control empy.

While styles file not shown?
How to show styles files items?

PS:
developed by Engine10 + VS2010 + QT4
0 Kudos
RichardWatson
Frequent Contributor
If you don't know how to write C++ code then use C#.  If the code you write has to be called by C++ code then expose it to COM.
0 Kudos
AzimAzim
New Contributor
Main concept - to write code unmanaged C++.
And i try to do it.

Is there anybody who has expirience whit writing code C++?
0 Kudos