title: Access Enum Array in Delphi
body: <p>I have enum type : </p>
  
  <pre><code>EPosition = (eLEFT, eRIGHT, eUP, eDOWN);
  </code></pre>
  
  <p>and EPosition array : </p>
  
  <pre><code>position: array[EPosition] of Integer;
  </code></pre>
  
  <p>Assign : </p>
  
  <pre><code>if (Key = VK_UP) then
    begin
      position[eTOP]:= 1;
    end;
  
    if (Key = VK_DOWN) then
    begin
      position[eDOWN]:= 1;
    end;
  
    if (Key = VK_LEFT) then
    begin
      position[eLEFT]:= 1;
    end;
  
    if (Key = VK_RIGHT) then
    begin
      position[eRIGHT]:= 1;
    end;
  </code></pre>
  
  <p>Then here is my error point :</p>
  
  <pre><code>for I := 0 to 3 do
      begin
        if obSubImage.PreviewROI.position[I] = 1 then
        begin
          obSubImage.RenderROI.width:= abs(oldNewDiff.X);
          obSubImage.RenderROI.height:= formMain.imgPreview.IEBitmap.Height;
          obSubImage.RenderROI.x:= obSubImage.PreviewROI.x;
          obSubImage.RenderROI.y:= obSubImage.PreviewROI.y;
          panOffsetX:= 0;
          panOffsetY:= 0;
          obSubImage.PreviewROI.position[I]:= 0;
          renderLayer(0);
        end;
      end;
  </code></pre>
  
  <p>It gives an incompatible types : 'EPosition' and 'Integer'.
  I know why it gives, i must write like;</p>
  
  <pre><code>    obSubImage.PreviewROI.position[eLEFT]:= 0;
  </code></pre>
  
  <p>But i don' t want to use IF-ELSE structure. I want to visit all index' s of array in LOOP. Is that possible?</p>