4 Replies Latest reply on Dec 1, 2014 1:55 AM by thomas.clchan

    button colour

    thomas.clchan

      Hi All,

       

       

       

      Can I change the button colour that I added in the display form? I want to replace the button colour to red and green.

       

       

       

      Also I want to know If I draw a rectangle on the form, Can I add mouse over event on it? I want change the mouse pointer to other picture when the mouse move over the rectangle.

       

       

       

      Thomas

        • Re: button colour
          Marcos Vainer Loeff

          Hello Thomas,

           

          Although the native button form PI ProcessBook is a symbol with the property BackgroundColor, it is not possible to change this property. The following code snippet lets you check if this feature it present programmatically:

           

           

           
          Const PBOA_USE_FILL_COLOR = 14
          
          Const PBOA_USE_BACKGROUND_COLOR = 15
          
          Public Sub CheckButtonCapabilities()
          
          Dim bHasCapability As Boolean
          
          bHasCapability = Button1.GetCapability(PBOA_USE_BACKGROUND_COLOR)
          If bHasCapability = False Then 
          MsgBox "This object can not use a Backgroundcolor"
          
          ElseIf bHasCapability = True Then
          MsgBox "This object can use a Backgroundcolor"
          
          End If
          

           

           

          You could use the "Microsoft Forms 2.0 CommandButton" which lets you choose the background color among some options provided. Nevertheless, I didn't see an option for the red or green color.

           

          On Microsoft Visual Basic, there are two comboboxes. On the left, you can see all the variables representing objects on the display. On the right, you can see its events. I was not able to "Enable Scripting" for the rectangle so you should try using a button instead with the options of events available for you to achieve your goal.

           

          Hope it helps!