Handle data between enumerated variables and "set of" in Delphi

Asked

Viewed 79 times

0

I have two variables of different types, but dependent, one type being a set of of the other kind which is a Enumerated Types. How do I extract the value from the type variable set of (Y in my case below) and assign to the type variable listed "X"? In my example, X would have to be equal to "bcA", using obligatory "Y" to extract the value. OBS.: programming in Delphi 10 with Android.

type
   TBaseCom_MODES = (bcA = 0, bcB = 1, bcN = 100);
   TBaseCom_MODES_Set = set of TBaseCom_MODES;

var X: TBaseCom_MODES;
    Y: TBaseCom_MODES_Set;
begin

   Y := [bcA, bcN];

   X := Y - [bcN]; // Aqui não funciona. Dá erro

end;
  • Which error?

  • What I presented was an example of something I wish existed (my example is not compilable). I’ve tried to present what I need done to know if anyone has any idea how to fix.

  • It does not even say which compilation error is given?

  • Error: "Incompatible Data Types". Copying the code and pasting into a form event will show the error F9.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.