Xbase++
Listed below are the questions that we are asked quite often. Before you write us, be sure to check here.

Programming

Programming

How to call the get/set property of an COM object, that has multiple parameters?

The Xbase++ provides methods like setProperty / getProperty to set or get a value for a specified COM property. :setProperty() is used to set a value of a property exposed by a COM/ActiveX component. Calling :setProperty() is required when accessing a property of a COM/ActiveX component that has the same name as an instance variable of the AutomationObject. Using :setProperty() is also required to when more than one value must be passed to the property of the connected COM/ActiveX component (multiple parameters).
oChart:SetProperty("PaneWidth",.F.,96)

instead of:

oChart:PaneWidth(.F.) := 96

Passing RGB values to COLOR properties

The Xbase++'s GraMakeRGBColor method calculates a RGB color value from color intensities of red, green and blue, that's not compatible with /COM objects, using the OLE automation. You need to use the AutomationTranslateColor function to convert the Xbase++'s color to an OLE color like in the following sample:
AutomationTranslateColor( GraMakeRGBColor({255,0,0}), .F. )

instead of:

GraMakeRGBColor({255,0,0})

so changing the color of the Task bar can be defined such as:

oG2antt:Chart():Bars():Item("Task"):Color = AutomationTranslateColor( GraMakeRGBColor({255,0,0}), .F. )

instead of:

 oG2antt:Chart():Bars():Item("Task"):Color = GraMakeRGBColor({255,0,0})

Can't use the BackColor/ForeColor properties of the control (Type mismatch, Parameter has a wrong data type ). What can be done?

The control's BackColor/ForeColor properties ( OLE_COLOR properties ) requires calling the SetProperty method, if using AutomationTranslateColor method as in the following samples:
oG2antt:BackColor := GraMakeRGBColor({255,0,0})

or

oG2antt:SetProperty("BackColor", AutomationTranslateColor( GraMakeRGBColor({255,0,0}), .F. ))

instead of:

oG2antt:BackColor := AutomationTranslateColor( GraMakeRGBColor({255,0,0}), .F. )

or:

oG2antt:BackColor := GraMakeRGBColor({255,0,0})

In conclusion, properties of Color type that belongs to the main object can be set using the GraMakeRGBColor({aRGB}) without AutomationTranslateColor method, and the AutomationTranslateColor(GraMakeRGBColor({aRGB})) for any other property of Color type that belongs to inside objects like in the following samples:

oG2antt:BackColor := GraMakeRGBColor({255,0,0})

or

oG2antt:Chart():BackColor := AutomationTranslateColor(GraMakeRGBColor({255,0,0}),.F.)

Changing/Using the Fonts

The Xbase++ provides the XbpFont class that can be used by control's Font properties like: ItemFont, CellFont,, ... and so on like in the following samples:
oFont := XbpFont():new():create( "12.Arial.Bold" )
oItems:SetProperty("ItemFont",h,oFont)
oFont:destroy()

Also the controls support built-in HTML format which implements the <font> HTML tag that can be used to change the font for a part of the caption like in the following sample:

oItems:SetProperty("CellValue", h, 0, "<font Arial;12>Item</font>Font")
oItems:SetProperty("CellValueFormat", h, 0, 1 /*exHTML*/)
 

"Receiver of message is not an object, (657): AUTOMATIONOBJECT:COPY" exception

Usually, this exception is fired once a native method of Xbase++ is called as a member of a COM object. For instance, the Copy method of the Bar object, copies the bar to a new bar, while the Copy method of the Xbase++ copies the selection to a clipboard. You need to use the callMethod method of Xbase++, to prevent the confusion, like in the following sample:
oBars:CallMethod("Copy","Task","STask"):Color := 0xff

instead of:

oBars:Copy("Task","STask"):Color := 0xff

"The PrintExt/PrintExts property must be set before calling Preview method" exception, when using the Exontrol.Print component

The exception is fired if the passed object to the PrintExt / PrintExts property of the Exontrol.Print component can be used to provide Print and Print Preview.
oG2antt:Template := "Dim p;p = CreateObject(`Exontrol.Print`);p.PrintExt = Me;p.AutoRelease = False;p.Preview();"

instead of:

oPrint := CreateObject("Exontrol.Print")
oPrint:PrintExt := oG2antt
oPrint:Preview()

Here's a sample that changes also the captions in the print and print preview framework

Template := "dim p;p=CreateObject(`Exontrol.Print`);"+;
"p.AutoRelease=True;"+;
"p.Caption=`Your Company Logo`;"+;
"p.ItemCaption(3)=`Auf Seitenbreite zoomen`;"+;
"p.ItemToolTip(4)=`Ganze Seite zoomen`;"+;
"p.ItemToolTip(5)=`Zwei Seiten zoomen`;"+;
"p.ItemCaption(101)=`<img>2</img>Eine Seite`;"+;
"p.ItemToolTip(101)=`<img>2</img>Eine Seite`;"+;
"p.ItemCaption(102)=`<img>3</img>Mehrere Seiten`;"+;
"p.ItemToolTip(102)=`<img>3</img>2 oder mehr Seiten`;"+;
"p.ItemCaption(103)=`<img>4</img>Einstellung`;"+;
"p.ItemToolTip(103)=`<img>4</img>Seite einrichten und Drucker wählen`;"+;
"p.ItemCaption(104)=`<img>5</img>Drucken`;"+;
"p.ItemToolTip(104)=`<img>5</img>Dokument drucken`;"+;
"p.ItemCaption(105)=`<img>6</img>Beenden`;"+;
"p.ItemToolTip(105)=`<img>6</img>Druckvorschau beenden`;"+;
"p.PageOrientation = 2;"+;
"p.Options=`FitToPage=On`;"+;
"p.PrintExt=Me;p.Preview()"
  
oDlg:oG2antt:ExecuteTemplate(Template)

You can find more about Print and Print Preview on Get Started page.

I am licensed on your component but the application works on development machine, and not on the client machine. What can I do?

The XBase++ requires to specify the value for License field using the control's runtime license key. The runtime license string is provided by us free of charge, at your request, while your maintenance or subscription is active ( NOT expired ). Your development license key is NOT the control's runtime license key. 

Here's a short sample where runtime-license key should go:

::oG2antt := xbpActiveXControl():new( ::drawingArea ,,{0,0}, {976,608})
   ::oG2antt:CLSID := "Exontrol.G2antt"
   ::oG2antt:license := "xxxxxxxxxx"

 where is "xxxxxxxxxx" is the control's runtime license key. Once again, the runtime license string is provided by us free of charge, at your request, while your maintenance or subscription is active ( NOT expired ). Your development license key is NOT the control's runtime license key.

Copyright 1999-2017 Exontrol. All rights reserved.