I am trying to create pens having colors and widths defined in a lookup table so that I can create a pen by an index number. Obviously, I don't understand the return domain for PEN. The debugger shows that a gdiplus_native::gpPen is created when I successfully create pens within the display code for a form.
An alternate approach would be to not try to create the pens, but just update an existing pen's color and width from a lookup table. This might be more efficient use of resources as well ... but I would really like to understand this a little better.
Both of the class predicate declarations for paintPen/1 below cause c504 errors:
class predicates % for the lookup tableADDENDUM: However, if I put the paintPen/1 declaration in the .cl file instead of the .pro file, everything compiles nicely.
p : ( integer PenNum, unsigned Color, real Width ) determ (i,o,o).
p( 0, color::darkred, 1 ).
p( 1, color::darkblue, 1 ).
% paintPen : ( integer PenNum ) -> gdiplus_native::gpPen.
% error c504 : The expression has type 'pen', which is incompatible with the type 'gdiplus_native::gpPen'
paintPen : ( integer PenNum ) -> pen.
% error c504 : The expression has type 'pen', which is incompatible with the type 'vpiDomains::
paintPen( PNO ) = P :-
PColor = color::create(C),
P = pen::createColor( PColor, Width, unitPixel ).
paintPen( _ ) = pen::createColor( color::create( color::black ), 1, unitPixel ).