1. Sivaprakash BKR
  2. PowerBuilder
  3. Saturday, 18 November 2017 05:47 AM UTC

Hello,

Issue 1 :

  1. Create a new user object < Customer Visual >
  2. Insert one picture control and one static text controls
  3. Enter a picture name for picture control and give a title in static text.
    1. This picture need to be a transparent picture
  4. Now the picture's background color and window's background color's are same
  5. Now change the background color of the window.  Window background color changes, not of picture's and static text's
  6. Close the window and re-open
  7. Now picture's background color also got changed.  

        Why we need to close and re-open the window to see the changed effect ?   

Issue 2

  1. Now in the constructor of the user object I change the background color of the window.  Run it and we could see the effect of change
  2. Now in the mousemove event / get focus event, I change the color of the window's background color, only window's background color gets changed, not of picture's.    Code given below
    1. Local External Function
      1. FUNCTION uint SetCapture(uint a_hWnd) LIBRARY "USER32.DLL"
        SUBROUTINE ReleaseCapture() LIBRARY "USER32.DLL"
    2. Instance variables
      1. Long il_backcolor =  RGB(87,116,146)
        Long il_focuscolor = RGB(22,160,133)
         
        Long il_rc // Work Var for Return Code.
        Integer ii_rc // Work Var for Return Code.
        Boolean ib_rc // Work var for Return Code.
         
        Long il_MinX, il_MaxX, il_MinY, il_MaxY, il_x, il_y, il_width, il_height
         
        Boolean ib_captured
    3. Constructor event of the UO
      1. il_Minx = This.X
        il_MaxX = This.X + This.Width
        il_MinY = This.Y
        il_MaxY = This.Y + This.Height

        il_X = This.X
        il_Y = This.Y
        il_Width = This.Width
        il_Height = This.Height

        This.Backcolor = il_backcolor
        st_1.Backcolor = il_backcolor

    4.  

      Mouemove event  of static text control and picture button control (pbm_mousemove)

      If Not ib_captured Then

      ib_captured = True
      SetCapture(Handle(This))
      st_1.BackColor = il_focuscolor
      This.Backcolor = il_focuscolor
      Parent.Backcolor = il_focuscolor
      Else 
      ib_captured = xpos > 0 and xpos < this.width and ypos > 0 and ypos < this.Height 
      If Not ib_captured Then
      ReleaseCapture()
      st_1.Backcolor = il_backcolor 
      This.Backcolor = il_backcolor
      Parent.Backcolor = il_backcolor
      End If
      End If

      When mouse moves over the static text or picture control, back color of every object changes, including the windows, but not of picture's.   

Any thing I need to do, the change of back color of the picture control ?  Changing the back color of the window in the editor or at the constructor event gives the correct effect not at run time.  Is it a bug or I'm missing anything ?

 

Happiness Always

BKR Sivaprakash

 

Frank Frey Accepted Answer Pending Moderation
  1. Monday, 27 November 2017 13:21 PM UTC
  2. PowerBuilder
  3. # 1

I had a smiliar issue with transparency of a picture inside a user control.

I'm not exactly sure what is happening with transparencies, but it seems that it wouldn't refresh correctly. My guess is, that it somehow calculates what lies beneath the transparency, replaces the transparency and paints it accordingly, once?

In my case, it was an user control used as a close button/control, which was placed on an element having different colors, based on input. The transparent part of the picture in the user control would stay the same, even if a new background color for the user element was set. A workaround was to use closeuserobject/openuserobject to create the same user object with the new color (you might even need a BringToTop call to ensure the element being on top, can't exactly remember the details).

Comment
There are no comments made yet.
George Mikhailovsky Accepted Answer Pending Moderation
  1. Sunday, 19 November 2017 01:26 AM UTC
  2. PowerBuilder
  3. # 2

I would just set background color of your Custom Visual Object to Transparent. Have you tried this? Best regards, George

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Saturday, 18 November 2017 17:20 PM UTC
  2. PowerBuilder
  3. # 3

I think you gave too much detail and not enough high level description of what exactly you are trying to accomplish.

Take a look at my custom canvas controls. The main one is the picture control but there is also a text control, combo text/picture control, and gradient control.

http://www.topwizprogramming.com/freecode_canvas.html

 

Comment
  1. Sivaprakash BKR
  2. Sunday, 19 November 2017 05:32 AM UTC
Sorry for not being clear.



My requirement is to show focus color for the whole object (which contains an image and static text) which mouse is on that user object or when the controls is on that uo (tab in). and remove the focus color when mouse is moved out or control moves out (tab out).



I created one transparent image and a static text in an user object. When I set the background color of the uo either at design time or at run time (in constructor event) everything works fine. the whole object shows in one color, both image and static text. When I move the mouse over to the object, the background color of static text and uo changes to focus color, not that of the image, even though the image designed with transparency.



I used the above code to achieve my result.

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.