Auto resize text gadget and transparency.

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
doctorized
Addict
Addict
Posts: 882
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

Auto resize text gadget and transparency.

Post by doctorized »

I saw that many of us want to resize a gadget when the window is resized.
I want something else. I want, mostly for the text gadget, to auto-resize itself according to the text that is displayed, as VisualBasic does.

An other useful property of the text gadget could be transparency. I have in mind full transparency, as VisualBasic does, this is very useful when we need to display a text in front of an image or whatever else we want. Transparency should work for frame gadgets too. I use a frame gadget in my program and the backround of the caption's text is grey, as grey is the color of the window, regardless of an image that lies between the frame and the window.

I found here, in this forum that transparency can be done with codes, like the following:

Code: Select all

Procedure WindowCallback(hWnd,uMsg,wParam,lParam)
    Select uMsg
        Case #WM_CTLCOLORSTATIC
         SetBkMode_(wParam,#TRANSPARENT)         
         SetBkColor_(wParam,#Blue)
         ProcedureReturn GetStockObject_(#NULL_BRUSH)
    EndSelect
     
    ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

SetWindowCallback(@WindowCallback())
As you see, Windows API is used, just like all other cases. What about Linux and MacOS?
Also, when we have a CheckBox, it turns into black when using the above code.
So, it should be supported by PureBasic internally.