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
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:
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:
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:
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:
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.
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)
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.
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