64-bit ActiveX issue setting FONT with Codejock control

Posted by Derek Lord on 29-Mar-2017 13:38

Switching to use Progress 64-bit (11.6.3), code which worked with he 32-bit controls does not work with Codejock's latest 64-bit controls (v18 or 17.3).

Setting the FONT on a property grid used to be as simple as:
CO-PropertyGrid:FONT:NAME = 'Calibri'
CO-PropertyGrid:FONT:SIZE = 20

This doesn't give any error, it just doesn't work, it is ignored, no font change.  Codejock say that it works in Visual Studio, but really in Visual Studio your are working with the 32-bit control and compiling for AnyCPU.

With a 64-bit Progress form I have to drop the 64-bit ActiveX control, I cannot drop the 32-bit controls.

As a work around they suggested doing something like this:

DEFINE VARIABLE vFont AS System.Drawing.Font NO-UNDO.

vFont = NEW System.Drawing.Font("Calibri",20).

CO-PropertyGrid:FONT = vFont.

But I cannot get this to work, I get the following error:
Error occurred while accessing component property/method: FONT.
The parameter is incorrect.

Is there a way to make this syntax work?

Any help would be greatly appreciated.

Derek

Posted by Laura Stern on 29-Mar-2017 15:12

My recollection is that this never worked!  That is because the Font property is returned by value - i.e., you get a copy of it, not a reference to the original one.  So you are setting the Name and Size on a different Font object than the one that actually belongs to the Label.  

So you can see why your work-around works.  Because now you are resetting the label's Font object to one with the values you want.  

I think there was a KBase on this way, way back when.

All Replies

Posted by Ken Ward on 29-Mar-2017 14:03

We use the Codejock Calendar control in our software. It sounds like the Font property for this control is read-only. If that's so, then you won't be able to set it with another Font object. Nothing else in your code looks off to me.

I can't seem to find proper documentation for a CodeJock PropertyGrid so I can't confirm my suspicion.

Posted by Brian K. Maher on 29-Mar-2017 14:06

Change :FONT to :Font and see if that solves it.

Posted by Derek Lord on 29-Mar-2017 15:00

Using :Font makes no difference, same error.

One of Codejocks controls is a Label control, which I can set no problem.

This works:

CO-Label:FONT:NAME   = 'Calibri'

CO-Label:FONT:SIZE   = 20

CO-PropertyGrid:FONT = CO-Label:FONT

This is a work around, but I hate it when 3rd party controls stop working the way they are documented to work.

I was hoping there was a way to cast between these two, as that is the way Codejock now say to do it:-

vFont = NEW System.Drawing.Font("Calibri",20).

CO-PropertyGrid:FONT = vFont.

Posted by Laura Stern on 29-Mar-2017 15:12

My recollection is that this never worked!  That is because the Font property is returned by value - i.e., you get a copy of it, not a reference to the original one.  So you are setting the Name and Size on a different Font object than the one that actually belongs to the Label.  

So you can see why your work-around works.  Because now you are resetting the label's Font object to one with the values you want.  

I think there was a KBase on this way, way back when.

This thread is closed