{Macros which illustrate the use of picNumber, pidNumber, } { SelectPic, and SelectWindow. } var line: integer; myPicNumber: integer; myPidNumber: integer; macro 'Create some images [A]'; var howMany: integer; i: integer; begin SetBackgroundColor(0); SetForegroundColor(255); howMany := GetNumber('How many images do you want?',5); while nPics < howMany do begin MakeNewWindow('new image'); SetPicName('PicNumber=',PicNumber:0,' PidNumber=',PidNumber:0); end; line := 1; for i := 1 to nPics do begin SelectPic(i); MoveTo(10,15*line); Write('PicNumber = ',picNumber,' PidNumber = ',pidNumber); end; end; macro 'SelectPic[B]'; var id: integer; begin id := GetNumber('(+) pic number or (-) pic ID to select',-1); SelectPic(id); end; macro 'Draw PicNumber and PidNumber in each image[C]'; var i: integer; begin SetBackgroundColor(0); SetForegroundColor(255); line := line + 1; for i := 1 to nPics do begin SelectPic(i); MoveTo(10,15*line); Write('PicNumber = ',picNumber,' PidNumber = ',pidNumber); end; end; macro 'Dispose of the front image[D]'; begin Dispose; end; macro 'DisposeAll[E]'; begin DisposeAll; end; macro 'This is my favorite image [F]'; begin myPicNumber := PicNumber; myPidNumber := PidNumber; line := line + 1; MoveTo(10,15*line); Write('Favorite: PicNumber = ',picNumber,'PidNumber = ',pidNumber); SetPicName('My Favorite Image'); end; macro 'Try to find my favorite image by PicNumber [G]'; begin SelectPic(myPicNumber); end; macro 'Try to find my favorite image by PidNumber [H]'; begin SelectPic(myPidNumber); end; macro 'Try to find my favorite image by window title [I]' begin SelectWindow('My Favorite Image'); end; macro 'Pick an image, any image...[P]'; begin SelectPic(trunc(random * nPics) + 1); end;