User Tools

Site Tools


readme:knownissues:activex

This is an old revision of the document!


DK for ActiveX

Documentation | Known issues | DK for ActiveX

TGIS_Shape.GetField

If text field contains an empty string then return value on all platforms should be just an empty string. However, if used in .NET, the returned value is empty. This is not our fault - .NET simply interprets a COM Variant object with an empty string as an Object with a null value. Therefore we suggest using a null-safe construct like:

mystring = shape.GetField("MYFIELD")?.ToString()'
if ( mystring == null )
  mystring = "";

In this code the “?” character is crucial. The “mystring”“ value still can be null, but at least there will be no runtime error upon conversion.

Using references to visual controls in API

Due to ActiveX limitation controls presented in API are not the exactly pure OCX objects but it is some kind of wrapper around. While it is obvious in .NET such behavior is a bit hidden in VB6. To access underlying OCX object please use: VB6

Legend.GIS_Viewer = GIS.Object
Scale.GIS_Viewer = GIS.Object
 
Dim lgndfrm as New TGIS_ControlLegendForm
lgndfrm.ShowLayerProperties layer, Legend.Object

.NET

Legend.GIS_Viewer = GIS.GetOcx()
Scale.GIS_Viewer = GIS.GetOcx()
 
(New TGIS_ControlLegendForm).ShowLayerProperties( layer, Legend.GetOcx())

Themes for Windows common controls and dialogs

To enable proper windows styling of the application created with Visual Studio a Manifest file is required. To do this add a default manifest file to the app and uncomment section:

<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<dependency>
  <dependentAssembly>
    <assemblyIdentity
        type="win32"
        name="Microsoft.Windows.Common-Controls"
        version="6.0.0.0"
        processorArchitecture="*"
        publicKeyToken="6595b64144ccf1df"
        language="*"
      />
  </dependentAssembly>
</dependency>

Manifest is Windows not Visual Studio specific, so it should be applied on application created in other environments as well.

2017/12/15 15:35