enumhelper

Posted by jmls on 06-Dec-2008 13:20

Needing some help here

given the following c# code:

and the ABL code:

why doesn't the comparison work, unless I change it to

also, how would I convert the following:

I've tried

but I get an "incompatible data types" message when compiling.

Thanks.

All Replies

Posted by Admin on 06-Dec-2008 14:26

Hi Julian,

the fact, that operator overloading (for enums) is not supported by the ABL is a pitty.

For this case, Shelley and Laura explained it to me as that = or EQ would compare the reference and not the value and since the object in the EventArgs and the static enum are two different references to the same .NET object, the ESQ does not work.

Try the AreEqual method of the EnumHelper instead.

So still room for improvement in 10.2B...

Especially, because you can't use the enumHelper in a CASE structure at all...

The second is a binary operation - I have no clue how to translate that. It's clear, why you get an compiler error: The AND method of the enumHelper returns an System.Enum type and that is not compatible to an ABL primitive integer (your 0).

Maybe something like:

EnumHelper:AreNotEqual(EnumHelper:And(e:Button, MouseButtons:Left), MouseButtons:None)

But I haven't tried that.

Hope that helped at least a little bit.

Mike

Message was edited by:

Mike Fechner

Posted by Admin on 06-Dec-2008 14:35

Details on the EnumHelper methods are in the GUI for .NET developers bible at:

http://www.psdn.com/library/entry.jspa?externalID=6151&categoryID=2141

Section 2-56 (or page 90)

Posted by GregHiggins on 07-Dec-2008 07:13

Did you try

IF unbox(e:Button) EQ unbox(System.Windows.Forms.MouseButtons:left) THEN

or maybe it's box(), I haven't internalized it yet.

This thread is closed