Page 1 of 1

Make an editor gadget transparent (richedit)

Posted: Fri Dec 14, 2007 8:28 pm
by superadnim
The following procedure I happen to use on a little project of mine, where I have a richedit required to have a transparent background (because the window has an image background!)

Code: Select all

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
It works just fine, make sure theres something on the back redrawing, if not your editor gadget won't have a background at all and thus it wont redraw.

(if someone could help me improve my function, that'd be nice!)

The old style is returned by the procedure, in case you want to revert it back.

Sorry if this was already posted, I just couldn't find it on the forums so I had to write my own. (I did find a code by Sparkie but it wasn't redrawing and it required quite a few hacks just to render a background image)

Posted: Fri Dec 14, 2007 10:14 pm
by Sparkie
superadnim wrote:(I did find a code by Sparkie but it wasn't redrawing and it required quite a few hacks just to render a background image)
Yep, that sounds like it would be mine. :lol:

Do you have a link to that so I can see what the hell I did wrong :?: The code I found on my HD for a transparent Editorgadget works fine. :?