1

a little out of my depth here.

I am using a component that has some Flags in the Object Inspector ...

FCOPY
  Flags
    flShowProgress
    flConfirmation

I need to change flShowProgess depending on the size of a file being copied.

if FileSize(aFilename) > 500000 then 
  FCOPY.Flags.flShowProgress:=True else
  FCOPY.Flags.flShowProgress:=False;

Obviously that does not compile. I have done a bunch of searching to find some examples but I really don't know the exact terms I need to use to find how to do this.

Could someone please show me how to do what I need with the Flags to turn on the flShowProgress only for files larger than 5M and then off again for the smaller files?

Thank you.

1 Answers1

5

Assuming flags is a property of type set.

    if FileSize(aFilename) > 5000000 then  // bytes!
      FCOPY.Flags:=FCOPY.Flags+[flShowProgress]
    else
      FCOPY.Flags:=FCOPY.Flags-[flShowProgress]
Marco van de Voort
  • 25,628
  • 5
  • 56
  • 89
  • Thanks, I was missing the square brackets. I almost had it correct after about 20 different tries, but the square brackets are the key. Thank you very much. – user3046760 Nov 28 '13 at 21:00
  • They change an element (enum) to a set. (of enum). Always keep clear in your mind what type something is. It is the key to understanding typed languages. – Marco van de Voort Nov 28 '13 at 21:09