Is there anyway to make a textgadget or a HyperLinkGadget transparent?
I have a bitmap in the background and when I put a text gadget on the bitmap it has a box around it.
Thanks

It should be possible but it requires an enormous amount of API code.spacebuddy wrote:Is there anyway to make a textgadget or a HyperLinkGadget transparent?
I have a bitmap in the background and when I put a text gadget on the bitmap it has a box around it.![]()
Code: Select all
OpenWindow(0, 200, 100, 256, 256, "With background image")
If LoadImage(0, #PB_Compiler_Home + "/examples/sources/Data/Background.bmp")
LoadFont(0, "Apple Chancery", 28, #PB_Font_Bold)
If StartDrawing(ImageOutput(0))
DrawingMode(#PB_2DDrawing_Transparent)
DrawingFont(FontID(0))
DrawText(20, 100, "Transparent Text", RGB(0, 0, 0))
StopDrawing()
EndIf
ImageGadget(0, 0, 0, WindowWidth(0), WindowHeight(0), ImageID(0))
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIfCode: Select all
EnableExplicit
ImportC ""
CreateCheckBoxControl(WindowRef.L, BoundsRectangle.L, CFStringTitle.L, InitialState.L, AutoToggle.L, *ControlRef)
CreateNewWindow(WindowClass.L, Attributes.L, *Bounds, *WindowRef)
DisposeEventHandlerUPP(EventHandlerUPP.L)
NewControlColorUPP(ControlColorProcPtr.L)
QuitApplicationEventLoop()
RGBBackColor(RGBColor.L)
RunApplicationEventLoop()
SetControlColorProc(ControlRef.L, ControlColorUPP.L)
ShowControl(ControlRef.L)
EndImport
#kEventClassWindow = 'wind'
#kEventWindowClose = 72
#kMovableModalWindowClass = 4
#kWindowCloseBoxAttribute = 1 << 0
#kWindowStandardHandlerAttribute = 1 << 25
#kControlMsgSetUpBackground = 23
Structure EventTypeSpec
EventClass.L
EventKind.L
EndStructure
Structure Rect
Top.W
Left.W
Bottom.W
Right.W
EndStructure
Structure RGBColor
Red.U
Green.U
Blue.U
EndStructure
Structure ControlBackgroundRec
BitDepth.W
IsColorDevice.B
EndStructure
Procedure ControlColorCallback(ControlRef.L, Message.W, ColorDepth.W, DrawInColor.L)
Protected BackgroundColor.RGBColor
BackgroundColor\Red = $B0B0
BackgroundColor\Green = $E0E0
BackgroundColor\Blue = $E6E6
If Message = #kControlMsgSetUpBackground
RGBBackColor(@BackgroundColor)
EndIf
EndProcedure
Procedure WindowCloseHandler(*NextEventHandler, EventRef.L, UserData.L)
QuitApplicationEventLoop()
ProcedureReturn 0
EndProcedure
Define Bounds.Rect
Define CheckBoxRef.L
Define ControlColorUPP.L
Define WindowCloseHandlerUPP.L
Define WindowRef.L
Dim EventTypes.EventTypeSpec(0)
Bounds\Top = 100
Bounds\Left = 270
Bounds\Bottom = 140
Bounds\Right = 460
If CreateNewWindow(#kMovableModalWindowClass, #kWindowCloseBoxAttribute | #kWindowStandardHandlerAttribute, @Bounds, @WindowRef) = 0
WindowCloseHandlerUPP = NewEventHandlerUPP_(@WindowCloseHandler())
EventTypes(0)\EventClass = #kEventClassWindow
EventTypes(0)\EventKind = #kEventWindowClose
InstallEventHandler_(GetWindowEventTarget_(WindowRef), WindowCloseHandlerUPP, 1, @EventTypes(), 0, 0)
ShowWindow_(WindowRef)
Bounds\Left = 10
Bounds\Top = 10
Bounds\Right = 180
Bounds\Bottom = 30
If CreateCheckBoxControl(WindowRef, @Bounds, CFStringCreateWithCString_(0, "Customized CheckBox", 0), 0, #True, @CheckBoxRef) = 0
ControlColorUPP = NewControlColorUPP(@ControlColorCallback())
SetControlColorProc(CheckBoxRef, ControlColorUPP)
ShowControl(CheckBoxRef)
EndIf
RunApplicationEventLoop()
DisposeEventHandlerUPP(WindowCloseHandlerUPP)
EndIf