PowerBuilder
Frequently Asked Questions (exontrol)
PB.0:
In PowerBuilder 32-bit you can use any of the following versions:
  • /COM indicates the 32-bit edition of the ActiveX version

The application built using /COM version runs on any Windows 32 or 64-bit machine.

In PowerBuilder 64-bit you can use any of the following versions:

  • /COM/64 indicates the 64-bit edition of the ActiveX version

The application built using /COM/64 version runs on Windows 64-bit machine only. The application built using /COM/64 version cannot run on Windows 32-bit machine.

If you want to use your application on 32 and 64-bit machines, you can go for:

  • /COM/ANY indicates the 32 and 64-bit editions of the ActiveX versions

Should I use a 32-bit or 64-bit version of the control?

PB.1:
Powerbuilder doesn't have the option to compile a custom manifest file in the application so we use an external manifest file. To do this, you have to do the following on your Powerbuilder project:
  • open the deployment properties of your project
  • open the security tab
  • under 'Generate Options': choose the option 'External Manifest' in the dropdown.
Now when you build your application, an external manifest file will be created that you can customize. 

The entries in the manifest file can be created using the ExHelper application.

For instance, the manifest file for PowerBuilder, to include the eXG2antt and eXPrint control can look such as:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
	<assemblyIdentity version="1.0.0.0" processorArchitecture="x86" name="Sybase.PB" type="win32"></assemblyIdentity>
	<description>PowerBuilder</description>	
	<dependency>
		<dependentAssembly>
			<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
		</dependentAssembly>
	</dependency>
	<file name="exg2antt.dll" hashalg="SHA1">
		<comClass clsid="{CD481F4D-2D25-4759-803F-752C568F53B7}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="Exontrol.G2antt" description="ExG2antt Chart ActiveX Control" miscStatusContent="recomposeonresize,setclientsitefirst,activatewhenvisible,cantlinkinside,insideout" />
		<comClass clsid="{2DD65709-C0BA-4764-AADF-820919FF181B}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.Column" description="Column Class" />
		<comClass clsid="{28AC7755-06AC-4439-9ADD-EA012B4B2F10}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.Columns" description="Columns Class" />
		<comClass clsid="{1801677D-52FE-4759-B10A-C4FE70EAE035}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.Items" description="Items Class" />
		<comClass clsid="{E2B55693-3D70-426B-9E08-ECF9DC93D98D}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.OleEvent" description="OleEvent Class" />
		<comClass clsid="{919D16E8-2002-4C11-BC81-1CA0FF8FDDEF}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.OleEventParam" description="OleEventParam Class" />
		<comClass clsid="{C39F7717-C8C1-44A0-A495-DB5E92FDC79D}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.Appearance" description="Appearance Class" />
		<comClass clsid="{9E3FB380-6CB7-4CCA-B726-FE191133A8A0}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.ExDataObjectFiles" description="ExDataObjectFiles Class" />
		<comClass clsid="{A30C0D8D-98A5-476B-860A-3397645BA8F8}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.ExDataObject" description="ExDataObject Class" />
		<comClass clsid="{4B82A833-421F-496F-BE2F-F5C41DBED707}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" description="Template Class" />
		<comClass clsid="{D4D088E8-0FA5-4414-A322-D105149D6313}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" description="TemplatePage Class" />
		<comClass clsid="{1AA7ABFA-8C27-4579-9F06-7CCFAF301B72}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.Editor" description="Editor Class" />
		<comClass clsid="{23AA3A91-C107-44B2-BD23-3978B343DB8A}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.Chart" description="Chart Class" />
		<comClass clsid="{7862FEFF-7FE6-401A-A692-CE4758CDD0FC}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.Level" description="Level Class" />
		<comClass clsid="{D6C57467-EC60-429F-87B7-3751DFB1EEAE}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.Bar" description="Bar Class" />
		<comClass clsid="{75A35E6C-2144-435F-96FF-0BE4A9643176}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.Bars" description="Bars Class" />
		<comClass clsid="{FC5F6509-4354-4D92-A9A9-24EEB081670E}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.ConditionalFormat" description="ConditionalFormat Class" />
		<comClass clsid="{DEDF38EB-BEEA-48D1-8D9E-AF0C81FA8E71}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.ConditionalFormats" description="ConditionalFormats Class" />
		<comClass clsid="{91E561B9-B514-4F1F-BAE1-3E5903C85DA3}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.InsideZoomFormat" description="InsideZoomFormat Class" />
		<comClass clsid="{513CF640-A498-4800-ACEF-4473491CF282}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.InsideZoom" description="InsideZoom Class" />
		<comClass clsid="{B6528DA9-8C75-4389-9B72-EE8A8C2BABA3}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.InsideZooms" description="InsideZooms Class" />
		<comClass clsid="{15F8B91F-49AD-4663-B878-8A3DE05E4A30}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.Notes" description="Notes Class" />
		<comClass clsid="{926F669D-85C4-4D6D-BC9D-BA3759D8B237}" tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" progid="ExG2antt.Note" description="Note Class" />
		<typelib tlbid="{70337FFD-810F-4CDC-B09A-44CDCEE7DF1B}" version="1.0" helpdir="" flags="HASDISKIMAGE" />
	</file>
	<file name="exprint.dll" hashalg="SHA1">
		<comClass clsid="{4DEB0D2B-6EBD-4A22-9835-48AB9CDC8088}" tlbid="{ED7B66F6-C533-48E9-B536-6F3B0E9C5839}" progid="Exontrol.Print" description="ExPrint ActiveX Control" />
		<comClass clsid="{F8DBA669-F3DB-423C-8744-8349C3D85554}" tlbid="{ED7B66F6-C533-48E9-B536-6F3B0E9C5839}" progid="ExPrint.Page" description="Page Class" />         
	</file>	
</assembly>

The PROGID is only required if you connect to the object directly by name in the code. We do this to verify that the DLL files are available in the directory. If we add the eXG2antt/eXPrint control directly to the user interface using the IDE than this isn't needed because underlying the CLSID is used by the IDE.

Sample code where the progid is required in the manifest:

oleobject lole

SetNull(lole)
lole = create oleobject
lole.ConnectToNewObject('Exontrol.G2antt')
...
Thanks to Jeroen Van Herwegen, Tauris, Belgium, who submitted the note.
PB.2:
The ItemFromPoint property returns the handle of the item from the specified cursor location. 

In order to use the ItemFromPoint function in PowerBuilder, you may want to use the x-script of control's ExecuteTemplate property as:

Event MouseMove(Button,Shift,X,Y)
LONG li_filenumber
li_filenumber = FileOpen ("pbdebug.txt", TEXTMODE!, WRITE!, LOCKWRITE!, APPEND! )
IF NOT isNULL(li_filenumber) AND li_filenumber > 0 THEN
            FileWriteEx(li_filenumber, string (this.object.ExecuteTemplate( "Dim h, c, hit; h = ItemFromPoint(-1,-1, c, hit )" ) ) + "~r~n" )
            FileClose(li_filenumber)
END IF
//Event end

where the ExecuteTemplate property executes x-script code and returns the result of the last operation. The x-script language is our internal programming language, that's provided by all of our /COM components, to access any property or method, that may be inaccessible due limitation of your programming language/environment.

Most of our UI controls provides the following properties that can work with x-script:

  • Template
  • TemplateDef
  • TemplatePut
  • ExecuteTemplate 
PB.3:
You may encounter this runtime error when you run your 64-bit application on a client machine. Please check also What files do I need to install on the client machine?

Because PowerBuilder is not able to handle runtime-licensed controls we offer your free of charge the runtime-less version of the component you purchased from us. The runtime-less version of the registered component is exactly the same as the one you evaluated, which means it works on the client machine using your PowerBuilder application.

Please contact us ASAP and provide the following information:

  • Company
  • Address
  • City
  • Country

Based on the information you provide we will build and send you a new update that includes the runtime-less version of the component, that can be used on your PowerBuilder environment. The new update includes the information you provided in the License page of the DLL, as you can see bellow:

PB.4:
The "C0148. The identifier 'cancel' conflicts with an existing property with this name." warning may occur if trying to handle events like AllowLink, AllowAutoDrag, BeforeDrawPart, BeforeExpandItem, BarParentChange, Edit, ValidateValue. These events contains a 'cancel' parameter, which makes the warning to show up.

The solution is to rename (aka 'acancel') and change the access type (pass by reference) for the 'cancel' parameter for the event as shown in the next picture:

This way you can use/set the 'cancel' parameter as 'acancel'.

Thanks to Helmut Katherl, Katherl Software GmbH who submitted the note.
PB.5:
The "C0148. The identifier 'cancel' conflicts with an existing property with this name." warning may occur if trying to handle events like AllowLink, AllowAutoDrag, BeforeDrawPart, BeforeExpandItem, BarParentChange, Edit, ValidateValue. These events contains a 'cancel' parameter, which makes the warning to show up. Instead of using any these events you can use the "Event" event (The Event notification occurs ANY time the control fires an event). The EventParam property gives access to an parameter during the Event event, giving the parameter index (zero-based)

For instance, let's say we need to prevent expanding or collapsing the items, so normaly we have to handle the BeforeExpandItem, and set the Cancel parameter on True as shown:

begin event BeforeExpandItem(long  Item,any  Cancel) - Fired before an item is about to be expanded (collapsed)
	Cancel = true
end event BeforeExpandItem

Using the Event/EventParam the sample shows as:

begin event Event(long  EventID) - Notifies the application once the control fires an event.
	if ( EventID = 16 )	then // BeforeExpandItem/16
		ole_1.Object.EventParam(1,true)
	end if
end event Event

Each event has an unique identifier (16 for BeforeExpandItem), so if you need to handle a different event, you can use the following x-script to determine the identifier (copy and paste the following x-script into your exhelper tool)

handle Event(EventID)
{
	print(EventParam(-2))
}

PB.6:
The "R0021. Bad runtime function reference" error typically occurs when a parameter is accessed by reference, which might not be fully supported in certain environments, such as PowerBuilder. This issue is particularly evident when calling methods that handle parameters passed by reference.

For instance, when invoking Object.HostEventParam(2) within the HostEvent, the error arises during the execution of the exHostChange event. This event is responsible for relaying the Change(Item, ColIndex, NewValue) event from the eXG2antt control. In this scenario, the NewValue parameter is passed by reference, and PowerBuilder may lack proper support for handling parameters that are referenced in this way. As a result, the runtime encounters difficulties processing the reference, leading to the "Bad runtime function reference" error.

A similar situation can be observed in the BeforeExpandItem event (exHostBeforeExpandItem), where the Cancel parameter is passed by reference. In both cases, the PowerBuilder environment might not be capable of managing parameters passed by reference, which causes the error to surface.

The following code uses ExecuteTemplate and x-scriptto prevent "R0021. Bad runtime function reference" error.

ls_NewValue = Object.ExecuteTemplate("Host.FormatABC(`str(value)`, Me.HostEventParam(2))")

The code assigns the value of the ls_NewValue variable to the new input that the user enters in the control's editor. This is achieved by handling the Change(Item, ColIndex, NewValue) event from the eXG2antt control, which captures the user's modified value. This code have effect during exHostChange notification.

The following code can be used to update the value of parameter passed by reference

Object.ExecuteTemplate("HostEventParam(2) = 1234")

The code updates the NewValue parameter to 1234, which takes effect during the exHostChange notification.