Page 1 of 1
Frame3DGadget text color
Posted: Thu Dec 07, 2006 9:03 am
by sirrab
Hi All
Sorry if this has been asked before but I have been able to find an answer in the form.
can you change the text color in a Frame3DGadget gadget?
Thanks
Craig
Posted: Thu Dec 07, 2006 9:54 am
by netmaestro
It can be done, but the normal SetGadgetColor in PureBasic won't do it.
Code: Select all
Global TextBackground=CreateSolidBrush_(GetSysColor_(#COLOR_BTNFACE))
Global TextForeground=#Red
Procedure WinProc(hWnd,Msg,wParam,lParam)
result = #PB_ProcessPureBasicEvents
If Msg=#WM_CTLCOLORSTATIC And lParam=GadgetID(0)
SetBkMode_(wParam,#TRANSPARENT)
SetTextColor_(wParam,TextForeground)
result = TextBackGround
EndIf
ProcedureReturn result
EndProcedure
OpenWindow(0,0,0,250,100,"Colored Frame3D",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
SetWindowCallback(@WinProc())
Frame3DGadget(0,10,10,230,80,"This is a Frame3D")
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
DeleteObject_(TextForeground)
DeleteObject_(TextBackground)
Using code from this sample, you can also change the background color of the text if so desired.
Posted: Thu Dec 07, 2006 10:02 am
by gnozal
If you don't mind using userlibs,
PureCOLOR is an alternative.
thanks for the info
Posted: Thu Dec 07, 2006 11:19 am
by sirrab
Thanks netmaestro
Glad that it wasn't me not being able to find the command
Posted: Thu Dec 07, 2006 11:21 am
by sirrab
gnozal wrote:If you don't mind using userlibs,
PureCOLOR is an alternative.
Hi I'm new to purebasic, what is userlibs?
Thanks
Sirrab
Posted: Thu Dec 07, 2006 11:57 am
by gnozal
sirrab wrote:gnozal wrote:If you don't mind using userlibs,
PureCOLOR is an alternative.
Hi I'm new to purebasic, what is userlibs?
A userlib is a special library created by a user wich adds functions to purebasic.
Once the userlib is installed (in %PureBasic%\PureLibraries\UserLibraries\), you can use it's functions like any other genuine purebasic function.
You can find some on my web site (
http://people.freenet.de/gnozal/ ) and many more here :
http://www.purearea.net/pb/english/userlibs.php
Hi I just found it :)
Posted: Thu Dec 07, 2006 12:07 pm
by sirrab
Hi,
I just downloaded your libary, very cool Thanks
Craig
Posted: Thu Jan 18, 2007 10:13 pm
by DoubleDutch
The PureColor library (while being great), doesn't set the colour of a frame3dgadget in xp theme mode.
Is this a bug, or can it not be done?
Posted: Thu Jan 18, 2007 10:21 pm
by ts-soft
You can only disable the xp-theme for the Frame3DGadget
here the changed example by netmaestro:
Code: Select all
Procedure DisableXPTheme(Gadget.l)
Protected DLL.l, Null.w
If OSVersion() >= #PB_OS_Windows_XP
DLL = OpenLibrary(#PB_Any, "uxtheme.dll")
CallFunction(DLL, "SetWindowTheme", GadgetID(Gadget), @Null.w, @Null.w)
CloseLibrary(DLL)
ProcedureReturn #True
EndIf
EndProcedure
Global TextBackground=CreateSolidBrush_(GetSysColor_(#COLOR_BTNFACE))
Global TextForeground=#Red
Procedure WinProc(hWnd,Msg,wParam,lParam)
result = #PB_ProcessPureBasicEvents
If Msg=#WM_CTLCOLORSTATIC And lParam=GadgetID(0)
SetBkMode_(wParam,#TRANSPARENT)
SetTextColor_(wParam,TextForeground)
result = TextBackGround
EndIf
ProcedureReturn result
EndProcedure
OpenWindow(0,0,0,250,100,"Colored Frame3D",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
SetWindowCallback(@WinProc())
Frame3DGadget(0,10,10,230,80,"This is a Frame3D")
DisableXPTheme(0)
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
DeleteObject_(TextForeground)
DeleteObject_(TextBackground)
Posted: Thu Jan 18, 2007 10:34 pm
by DoubleDutch
Thats a good idea.
Its a pity though that the XP theme curved box looks so much better.
Posted: Thu Jan 18, 2007 10:52 pm
by DoubleDutch
Found a fix (until its maybe sorted out)...
I create the frame3dgadget without any text...
then put a normal text gadget over the frame3d gadget and use normal colouring on that.
Works great!

Posted: Thu Jan 18, 2007 11:13 pm
by Fluid Byte
The PureColor library (while being great), doesn't set the colour of a frame3dgadget in xp theme mode.
Still possible!
http://www.purebasic.fr/english/viewtop ... 12&t=42743
Posted: Thu Jan 18, 2007 11:30 pm
by srod
Very nice. Great example.

Posted: Fri Jan 19, 2007 12:14 am
by DoubleDutch
It would be good if this could be integrated into either the native or PureColor commands.
Posted: Fri Jan 19, 2007 1:54 am
by Flype
thanks for this one Fluid Byte.