5 Replies Latest reply on May 26, 2015 9:55 AM by PFC5478

    Using symbols or control

    PFC5478

      Dear all,

       

      In the below coding(pic 1), I can use Symbol to control dynmic item(rectangle)s to fill the colour I want.

      But If I want to use item as "Microsoft Forms 2.0 Image" in pdi, how can I using dynmic method on it? I want to change the image to depend on the status.

       

       

       

       

      Pic 1

      Used1.jpg

       

      Pic 2

      Used2.jpg

       

      Regards,

       

      Simon

        • Re: Using symbols or control
          Eugene Lee

          Hi Simon,

           

          The image item is a different class from PB symbols. So you can do this:

           

          Image1.BackColor = RGB(255, 0, 0)

           

          Where Image1 is the name of the Image item . My example will set it to Red.

            • Re: Using symbols or control
              PFC5478

              Thanks Eugene.

               

              May be I give more information what I wanted.

               

              I had done a program to change rectangle colour(red, green,yellow) depend on the pi tag's value. In the coding, I used symbols with dynmic control (item name A1, A2..... input to the funcation, one function can control all item(rectangle fill with colour))

               

              But now, our designer want to change using Picutre replace rectangle. Any help on coding where I want change the picture link on the "Microsoft Forms 2.0 Image's control" or Garphic? Symbols seem not work.

               

              I want as below:

               

              Write a function : Function change_pic(string item)

               

               

              change_pic(A1, pic1)

               

              result:      image of A1 will display pic1

               

              change_pic(C1, pic3)

              result :     image of C1 will display pic3

               

               

               

              Any one can help me? I don't want one pic with their own coding.

               

               

              Simon

                • Re: Using symbols or control
                  Eugene Lee

                  It seems that the PB display doesn't expose these specific form controls as a collection so there is no equivalent of Symbols in that case. What you could do is perhaps an IF statement like

                   

                  Sub change_pic(container As String, picture As String)

                  If container = "Image1" Then

                  Image1.picture = LoadPicture(picture)

                  End If

                   

                  you can then call this like

                   

                  change_pic "Image1", "C:\Users\eugene\Desktop\test.bmp"

                  • Re: Using symbols or control
                    gregor

                    Hello Paul,

                     

                    Does Eugene's last answer enable you to do what your designer asked for?

                      • Re: Using symbols or control
                        PFC5478

                        Thanks Eugene and Gregor for reply.

                         

                        I have passed the answer to our designer. In the past few weeks we have concentrated on

                        business logic issues and pending in working on interface. Sorry for that.

                         

                        I have marked Eugene's reply as correct answer. This question can also be closed. Thanks a lot!