Posts: 1,769
Threads: 410
Joined: Feb 2003
i setup those functions you created last week and got the transparent tb thing working great but i had to reinstall qm with that qml file and now i cant get them to work. i'm using the alpha and i cant figure out what the prob is; they are displaying just as if the hook wasnt setup.
/hook Toolbar_transp /col 0xc8d0d4 /mov 260 3 /siz 293 18 /set 1|32
function# hWnd message wParam lParam
sel message
,case WM_CREATE
,Transparent hWnd 250 GetSysColor(COLOR_BTNFACE) ;;background transparent, for mouse too
,;Transparent hWnd 150 ;;all colors partally transparent
any ideas why?
note: im using the 2.1.7 alpha...
Posts: 12,135
Threads: 142
Joined: Dec 2002
The Transparent function works only on Win2000 and above.
Posts: 1,769
Threads: 410
Joined: Feb 2003
Posts: 12,135
Threads: 142
Joined: Dec 2002
Is the hook function called? Insert out 1 before Transparent, and you should see 1 in the output when you launch the toolbar.
Posts: 1,769
Threads: 410
Joined: Feb 2003
yes the function is called "Toolbar_transp".
i am getting the "1" in the output from the function, so it is getting called.
could the button face colour be different now even though i'm not assigning it?
edit: i don't have to make any other changes besides copying over the qml do i?
Posts: 12,135
Threads: 142
Joined: Dec 2002
I did not noticed that toolbar color is changed in your toolbar. Use that color insted of GetSysColor(...).
Transparent hWnd 250 0xc8d0d4
Posts: 1,769
Threads: 410
Joined: Feb 2003
Oh you're gonna love this!!
the new video card was set to "High Colour" and I used to run at "True Colour" I switched it over and BOOOOOM! now it works!
:oops:
ps:that new line of code you sent didn't work before the video setting switch....
Posts: 12,135
Threads: 142
Joined: Dec 2002
To have less problems, remove that /col ... in the toolbar, and use GetSysColor(...) in the function. Or, set the back color to some simple color that would be the same on all display color resolutions, eg magenta 0xff00ff. When you use 0xc8d0d4, it is changed because such color cannot be displayed exactly on 16 bit color resolution.
Posts: 1,271
Threads: 399
Joined: Mar 2003
i have setup kens script, but my toolbar is not transparent.
i want to have some extra buttons in every main windows caption bar.
.
Posts: 12,135
Threads: 142
Joined: Dec 2002
Make sure that toolbar's background color is the same color as argument 3 of Transparent. By default, it is standard color that can be retrieved with GetSysColor(COLOR_BTNFACE). Here it is changed (/col 0xc8d0d4).
Posts: 12,135
Threads: 142
Joined: Dec 2002
That thread disappeared. Here are the functions we talked about.
On Win 2000 and above, we can make a toolbar transparent. We also can set backbround bitmap. We can combine those two things and have a simple skin. In the first line of the toolbar, specify appropriate hook function, like in this example:
Hook function that makes a toolbar transparent:
function# hWnd message wParam lParam
sel message
,case WM_CREATE
,Transparent hWnd 254 GetSysColor(COLOR_BTNFACE) ;;background transparent, for mouse too
,;Transparent hWnd 150 ;;all colors partally transparent
Hook function that sets background bitmap:
function# hWnd message wParam lParam
type MEMORYBITMAP dc bm oldbm
MEMORYBITMAP* m
sel message
,case WM_CREATE
,
,lpstr bitmapfile="$desktop$\test.bmp" ;;change this
,
,m._new
,m.bm=LoadImage(0 _s.expandpath(bitmapfile) IMAGE_BITMAP 0 0 LR_LOADFROMFILE)
,if(m.bm)
,,m.dc=CreateCompatibleDC(0)
,,m.oldbm=SelectObject(m.dc m.bm)
,,SetProp hWnd "bitmap" m
,
,case WM_ERASEBKGND
,m=+GetProp(hWnd "bitmap")
,if(m)
,,RECT r; GetClientRect hWnd &r
,,FillRect wParam &r COLOR_BTNFACE+1
,,BitBlt wParam 0 0 r.right r.bottom m.dc 0 0 SRCCOPY
,,ret 1
,
,case WM_DESTROY
,m=+GetProp(hWnd "bitmap")
,if(m)
,,RemoveProp hWnd "bitmap"
,,DeleteObject(SelectObject(m.dc m.oldbm))
,,DeleteDC m.dc
,,m._delete
Hook function that sets background bitmap and a transparent color. Parts of the bitmap that match the color will be transparent:
function# hWnd message wParam lParam
type MEMORYBITMAP2 dc bm oldbm br
MEMORYBITMAP2* m
sel message
,case WM_CREATE
,
,lpstr bitmap_file="$desktop$\test2.bmp" ;;change this
,int transparent_color=0xff00ff ;;magenta will be transparent, for mouse too
,;Fill transparent areas of the bitmap with the transparent color, remove
,;border, and toolbar will look and behave like with a simple skin.
,
,Transparent hWnd 254 transparent_color
,
,m._new
,m.bm=LoadImage(0 _s.expandpath(bitmap_file) IMAGE_BITMAP 0 0 LR_LOADFROMFILE)
,if(m.bm)
,,m.dc=CreateCompatibleDC(0)
,,m.oldbm=SelectObject(m.dc m.bm)
,,SetProp hWnd "bitmap" m
,,
,,m.br=CreateSolidBrush(transparent_color)
,
,case WM_ERASEBKGND
,m=+GetProp(hWnd "bitmap")
,if(m)
,,RECT r; GetClientRect hWnd &r
,,FillRect wParam &r m.br
,,BitBlt wParam 0 0 r.right r.bottom m.dc 0 0 SRCCOPY
,,ret 1
,
,case WM_DESTROY
,m=+GetProp(hWnd "bitmap")
,if(m)
,,RemoveProp hWnd "bitmap"
,,DeleteObject(SelectObject(m.dc m.oldbm))
,,DeleteDC m.dc
,,DeleteObject m.br
,,m._delete
Posts: 1,271
Threads: 399
Joined: Mar 2003
thats pretty cool.
my only problem left is the margins around mouseover on a qm toolbar item.
;/hook Toolbar_transp /mov 260 3 /siz 100 12 /set 1|32|64 /isiz 12 12 /col 0xb0e0b0
but thats only a visual problem.
thanks !
|