I have made a Powerbuilder classic window with a transparent background which works almost perfectly for the task I'm trying to achieve. I'm trying to have a transparent window topmost over all other applications (achieved that part so far), which has a static text control on it. I need the window and the text background to be 100% transparent but to have the actual text 100% visible. The plan is to have text overlay a 3rd party video player but have everything else in my PB app transparent so only the text shows. NOTE: I do not want to embed the video player as part of my window, this will always be a 3rd party app (that has no text overlays possible within that app).
Ignoring the video playing part for now, how can I make a window with both it's background and static text control background totally invisible but allow the text itself to be 100% visible?
PB2019.
- You are here:
- Home
- Q&A
- Q&A
- PowerBuilder
- Powerbuilder Classic window 100% transparent background with static text 100% visible
- David Hepburn
- PowerBuilder
- Tuesday, 25 July 2023 00:29 AM UTC
- Monday, 31 July 2023 06:46 AM UTC
- PowerBuilder
- # Permalink
Here a small example window that works for me with PB 2019 R3.
I've only copied the external functions declarations. If you want to use the example in a 64bit application you shound change the pointer variables!
There is still a remaining small shadow of window background color around the text. I don't know how to remove this. Because of this I choosed two almost identical colors (blue and navy) for window background and text color in my example.
forward
global type w_test from window
end type
type st_1 from statictext within w_test
end type
end forward
global type w_test from window
integer width = 873
integer height = 372
boolean titlebar = true
string title = "Untitled"
boolean controlmenu = true
boolean minbox = true
boolean maxbox = true
boolean resizable = true
long backcolor = 16711680
string icon = "AppIcon!"
boolean center = true
st_1 st_1
end type
global w_test w_test
type prototypes
Function long GetWindowLong (ulong hWnd, int nIndex) Library "user32.dll" Alias for "GetWindowLongW"
Function long SetWindowLong (ulong hWnd, int nIndex, long dwNewLong) Library "user32.dll" Alias for "SetWindowLongW"
Function Long SetLayeredWindowAttributes(ulong hWnd, Long crKey , byte bAlpha , Long dwFlags) Library "user32.dll"
Function Boolean SetMenu(ulong hWnd, ulong hMenu) Library "user32.dll"
end prototypes
on w_test.create
this.st_1=create st_1
this.Control[]={this.st_1}
end on
on w_test.destroy
destroy(this.st_1)
end on
event open;Constant long LWA_COLORKEY = 1
Constant long GWL_EXSTYLE = -20
Constant long WS_EX_LAYERED = Long(2^19)
Constant long GWL_STYLE = -16
Constant long WS_VISIBLE = 268435456
Constant long WS_MAXIMIZE = 16777216
Constant long WS_CLIPCHILDREN = 33554432
Constant long WS_CLIPSIBLINGS = 67108864
long ll_null_handle
SetWindowLong ( Handle(this), GWL_EXSTYLE, &
GetWindowLong( Handle (this), GWL_EXSTYLE ) + WS_EX_LAYERED)
SetLayeredWindowAttributes(Handle(this), This.BackColor , BYTE(0), LWA_COLORKEY)
SetWindowLong(Handle(THIS), GWL_STYLE, WS_VISIBLE /*+ WS_MAXIMIZE */ + WS_CLIPCHILDREN + WS_CLIPSIBLINGS)
THIS.ClientEdge = FALSE
SetNull(ll_null_handle)
SetMenu(Handle(THIS), ll_null_handle)
end event
type st_1 from statictext within w_test
integer x = 197
integer y = 56
integer width = 439
integer height = 160
integer textsize = -20
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 8388608
long backcolor = 553648127
string text = "TEST"
alignment alignment = center!
boolean focusrectangle = false
end type
- David Hepburn
- Tuesday, 1 August 2023 01:13 AM UTC
-
Helpful Loading... Helpful 0
- Monday, 31 July 2023 08:58 AM UTC
- PowerBuilder
- # 1
Maybe it would help if you could explain a bit more.
- why use powerbuilder for overlaying a third party video player?
- does your 3rd party video player allow for LUA programming?
Maybe someone could have a better solution for what you are trying to achieve here, it seems pretty twisted to me :S
regards.
- David Hepburn
- Monday, 31 July 2023 22:52 PM UTC
6 x 1920x1080 = 9600x1080
If I'm missing something here and somehow we can create a window that wide then let me know...
-
Helpful Loading... Helpful 0
- David Hepburn
- Monday, 31 July 2023 23:00 PM UTC
The idea is I kick off the multimedia player then open 6 x 1920x1080 transparent windows over the top of the video player which has the pricing text.
The 3rd party player itself does not support text overlay.
-
Helpful Loading... Helpful 1
- Miguel Leeuwe
- Tuesday, 1 August 2023 02:29 AM UTC
-
Helpful Loading... Helpful 0
- Wednesday, 26 July 2023 13:32 PM UTC
- PowerBuilder
- # 2
I think it should work with Windows API.
You can start with this article. Set window background color to a standard color (e.g. "White" not "buttonface").
A short test seems to work.
https://answers.sap.com/questions/11170828/transparent-window-in-pb.html
- David Hepburn
- Monday, 31 July 2023 03:57 AM UTC
I tried the above and no joy unfortunately.
-
Helpful Loading... Helpful 0
- René Ullrich
- Monday, 31 July 2023 05:18 AM UTC
-
Helpful Loading... Helpful 0
- David Hepburn
- Monday, 31 July 2023 06:14 AM UTC
-
Helpful Loading... Helpful 0
- Wednesday, 26 July 2023 11:32 AM UTC
- PowerBuilder
- # 3
Hi, David -
You might consider using a DataWindow to display the text instead of a Static Text or Single Line Edit control, as the latters are rendered by the Windows O/S and the former is rendered by PB. This is what I would try if I were trying to solve this issue.
It might also help for you to show us your code in order for us to perform a little experimentation, as Miguel has suggested.
Best regards, John
- Miguel Leeuwe
- Wednesday, 26 July 2023 13:03 PM UTC
Worth a try though!
regards
-
Helpful Loading... Helpful 0
- Tuesday, 25 July 2023 01:23 AM UTC
- PowerBuilder
- # 4
Hi,
Try using a single line edit control instead of a static text.
Set the transparency for the background in its font. Not in the control itself.
Hope it works!
- Miguel Leeuwe
- Wednesday, 26 July 2023 07:16 AM UTC
I'm just guessing, if I have some time I'll try it myself, but I don't know how to make the window transparent?
-
Helpful Loading... Helpful 0
- Miguel Leeuwe
- Wednesday, 26 July 2023 07:17 AM UTC
-
Helpful Loading... Helpful 0
- David Hepburn
- Monday, 31 July 2023 03:55 AM UTC
-
Helpful Loading... Helpful 0
- Page :
- 1
However, you are not allowed to reply to this question.