
String Gadget Background Transparent?
You Aussies are nuts!
Complete screwballs!
Now leave me in peace whilst I negotiate purchasing the moon from this kind hearted broom handle. And to think that the washing machine said I'd never get a decent price!
Blooming crazy Aussies...
(btw dare, your egrid licence will self-destruct in 24 hours. Say your prayers laddie!)
Complete screwballs!
Now leave me in peace whilst I negotiate purchasing the moon from this kind hearted broom handle. And to think that the washing machine said I'd never get a decent price!
Blooming crazy Aussies...

(btw dare, your egrid licence will self-destruct in 24 hours. Say your prayers laddie!)
I may look like a mule, but I'm not a complete ass.
Re: String Gadget Background Transparent?
A little threadnomancy here, but it feels the best place to ask - if I want to use the EditorGadget, what needs to change?
Whenever I try it, I just get a solid black background...
Whenever I try it, I just get a solid black background...
Re: String Gadget Background Transparent?
I thought this was a new post! Ugh, oh well. Maybe this will be useful to someone...
Code: Select all
;IncludeFile "C:\code\pb\include\WinAPI.pbi"
Declare OpenTransparentWindow(transColor.l, x.l, y.l, width.l, height.l, title.s, flag.l)
window = OpenTransparentWindow(RGB(255,254,253), 0, 0, 400, 400, "Invisible string gadget background", #PB_Window_SystemMenu)
StringGadget(0, 5, 5, 105, 23, "Test contents")
font = LoadFont(#PB_Any, "Arial", 12)
SetGadgetFont(0, FontID(font))
SetGadgetColor(0, #PB_Gadget_BackColor, RGB( 255,254, 253))
SetGadgetColor(0, #PB_Gadget_FrontColor, RGB( 255, 255, 255))
SetWindowColor(window, RGB(200,200,200))
HideWindow(window, 0)
While Not eventID = #PB_Event_CloseWindow
eventID = WaitWindowEvent(1)
Delay(10)
Wend
Procedure OpenTransparentWindow(transColor.l, x.l, y.l, width.l, height.l, title.s, flag.l) ;-- Create an invisible, borderless, and transparent window
; HideWindow(winResult, 0) after gadgets have been placed. Otherwise you may see flicker.
; I do not know if this works on all versions of windows or just Vista / 7
; I have only tested on both x86 and x64 Windows 7
winResult = OpenWindow(#PB_Any, 1, 1, 1, 1, title.s, #PB_Window_Invisible | flag.l)
SetWindowColor(winResult,transColor)
SetWindowLongPtr_(WindowID(winResult),#GWL_EXSTYLE, #WS_EX_LAYERED) ; -- According to the MSDN, this function will work with both x86 and x64 ( http://msdn.microsoft.com/en-us/library/ms644898(v=VS.85).aspx )
SetWindowPos_(WindowID(winResult),#Null, x, y, width, height, #Null) ; -- Must redraw window, according to the MSDN
SetLayeredWindowAttributes_(WindowID(winResult),transColor,#Null,#LWA_COLORKEY)
ProcedureReturn winResult
EndProcedure
▓▓▓▓▓▒▒▒▒▒░░░░░
Re: String Gadget Background Transparent?
Thanks, I found the answer now.
The complete question I should have asked was "how do I make a transparent, borderless, wordwrapped, scrollbarless editorgadget?"
Answer?
The complete question I should have asked was "how do I make a transparent, borderless, wordwrapped, scrollbarless editorgadget?"
Answer?
Code: Select all
UseJPEGImageDecoder()
Procedure.l hWndTransparent( hWnd.l )
Define.l lwTemp
#WS_EX_TRANSPARENT = $20
lwTemp = GetWindowLong_(hWnd, #GWL_STYLE)
SetWindowLong_(hWnd, #GWL_EXSTYLE, lwTemp | #WS_EX_TRANSPARENT)
ProcedureReturn lwTemp
EndProcedure
; --> Get our background image
imageBG$ = (OpenFileRequester("Select background", "c:\", "Image files (JPG, JPEG, BMP)|*.jpg;*.bmp", 0))
If imageBG$ <> ""
myImage = LoadImage(0, imageBG$)
; --> create brush for our window background
containerBrush = CreatePatternBrush_(ImageID(0))
Else
; cancelled
End
EndIf
StartDrawing(ImageOutput(0))
For x = 10 To 210
For y = 10 To 210
colour = Point(x, y) | $AAAAAA
Plot(x, y, colour)
Next
Next
StopDrawing()
Global stringpattern.l, bkswitch.l = 0
OpenWindow(0,0,0,320,240,"",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
ImageGadget(0,0,0,0,0,ImageID(0))
DisableGadget(0, #True)
EditorGadget(1,10,10,200,200)
SetWindowTheme_(GadgetID(1), @null.w, @null.w)
SetWindowLongPtr_(GadgetID(1),#GWL_EXSTYLE,0)
SendMessage_(GadgetID(1), #EM_SETTARGETDEVICE,0, 0)
SendMessage_(GadgetID(1),#EM_SHOWSCROLLBAR, 1, 0) ; disable scrollbar
hWndTransparent(GadgetID(1))
Repeat:Until WaitWindowEvent()=#WM_CLOSE
DeleteObject_(stringpattern)