[DUG] TPageControl InterestingObservation D2007

David Moorhouse delphi at moorhouse.net.nz
Wed Aug 29 09:59:52 NZST 2007


John Bird wrote

>And other code to set the tab control programmatically...eg
>
>//set tab back to where mode is
>	if frmLookup.visible=true then exit; //don't mess up lookup
>	if RunMode = 'Run' then pagecontrol1.activepageindex:=0;
>	if RunMode = 'Finish' then pagecontrol1.activepageindex:=1;
>	if RunMode = 'Start' then pagecontrol1.activepageindex:=2;
>	if RunMode = 'Disb' then pagecontrol1.activepageindex:=3;
>
>And so on....

Which would be a perfect candidate for enumerated values ...

TRunMode = (rmRun, rmFinish, rmStart, rmDisb);
...
// var
  RunMode: TRunMode;

//set tab back to where mode is
  if frmLookup.visible=true then exit; //don't mess up lookup
  pagecontrol1.activepageindex := Integer(RunMode);
//etc

HTH

D



More information about the Delphi mailing list