Hello, I would like to ask, there are 5 buttons on the form, and each button has a picture, when you click on Button1, only the first picture is displayed, when Button2 is the second, and so on. Is it possible to combine the visible property for admissible 2,3,4,5 images? To each not to prescribe it?

    2 answers 2

    Create a procedure / function (or whatever it is called in Delphi), in which you show / hide pictures under the necessary numbers. Then just broadcast this function to the desired button.
    Or you can write one function for all buttons, but the numbers of images with which it should work, calculate dynamically based on the number (name) of the button that called this function.

      An example of accessing several components at once:

      for ilocal: = 1 to 5 do
      TImage (self.FindComponent ('Image' + inttostr (ilocal))). Visible: = false;