formelement and fillprimitive

Posted by jmls on 16-Sep-2008 14:19

Came across some interesting code recently, and was trying to convert it to ABL. The form has a .net control dropped on, and I'm trying to fill the control with a graident

c#:

FillPrimitive formFill = ((FillPrimitive)this.FormElement.Children[2].Children[1]);

formFill.BackColor = Color.FromArgb(225, 240, 254);

formFill.BackColor2 = Color.FromArgb(0, 74, 97);

formFill.GradientAngle = 75;

formFill.GradientStyle = GradientStyles.Linear;

formFill.NumberOfColors = 2;

ABL:

DEF VAR formFill AS FillPrimitive NO-UNDO.

formFill = CAST(THIS-OBJECT:Formelement:Children[2]:Children[1],"FillPrimitive").

formFill:BackColor = Color:FromArgb(225, 240, 254).

formFill:BackColor2 = Color:FromArgb(0, 74, 97).

formFill:GradientAngle = 75.

formFill:GradientStyle = GradientStyles:Linear.

formFill:NumberOfColors = 2.

1) is this the right conversion.

2) If it is, then in c# I am getting the control filled, in ABL I cam getting the form itself filled

am I missing something subtle ?

All Replies

Posted by Peter Judge on 16-Sep-2008 14:29

Came across some interesting code recently, and was

trying to convert it to ABL. The form has a .net

control dropped on, and I'm trying to fill the

control with a graident

c#:

FillPrimitive formFill =

((FillPrimitive)this.FormElement.Children[2].Children[

1]);

formFill.BackColor = Color.FromArgb(225, 240, 254);

formFill.BackColor2 = Color.FromArgb(0, 74, 97);

formFill.GradientAngle = 75;

formFill.GradientStyle = GradientStyles.Linear;

formFill.NumberOfColors = 2;

VAR formFill AS FillPrimitive NO-UNDO.

formFill =

CAST(THIS-OBJECT:Formelement:Children[2]:Children[1],"

FillPrimitive").

formFill:BackColor = Color:FromArgb(225, 240, 254).

formFill:BackColor2 = Color:FromArgb(0, 74, 97).

formFill:GradientAngle = 75.

formFill:GradientStyle = GradientStyles:Linear.

formFill:NumberOfColors = 2.

1) is this the right conversion.

Looks fine to me. I'd CAST(..., FillPrimitive) rather than to "FillPrimitive".

2) If it is, then in c# I am getting the control

filled, in ABL I cam getting the form itself filled

am I missing something subtle ?

Probably but it's not evident from the code you posted. Are the formFill types the same in C# and ABL?

-- peter

-- peter

Posted by jmls on 16-Sep-2008 14:33

I tried cast FillPrimitive instead of "FillPrimitive". Same effect.

How do I check the type ? :type doesn't work

Posted by Peter Judge on 16-Sep-2008 16:35

How do I check the type ? :type doesn't work

I usually just MESSAGE the object reference, which often shows the type.

-- peter

Posted by Admin on 16-Sep-2008 20:36

How do I check the type ? :type doesn't work

The GetType() method is the .NET variant of :TYPE (for ABL widgets). Try :GetType():ToString().

This thread is closed