user3046760
user3046760

Reputation: 41

Delphi Setting bit Flags

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.

Upvotes: 1

Views: 646

Answers (1)

Marco van de Voort
Marco van de Voort

Reputation: 26358

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]

Upvotes: 5

Related Questions