PureCOLOR library : coloring gadgets (and much more)
Moderator: gnozal
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Update (all versions)
Changes :
- (new) menu functions : changed tab calculation. Tabbed menu items should now be correctly aligned in all cases.
EDIT : uploaded version 13.02
Changes :
- (new) menu functions : changed tab calculation. Tabbed menu items should now be correctly aligned in all cases.
EDIT : uploaded version 13.02
Last edited by gnozal on Mon Nov 26, 2007 5:16 pm, edited 1 time in total.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
You could also draw on the window :byo wrote:It's not working here:
Unless there's something else to be done or I'm doing something wrong.Code: Select all
SetGadgetText(#txDicas, dica) InvalidateRect_(WindowID(#wMain), rect, #True)
Thanks for the fast reply.
Code: Select all
...
Select EventGadget()
Case 2
SetGadgetText(0, "this text was changed correctly!")
If StartDrawing(WindowOutput(0))
Box(GadgetX(1), GadgetY(1), GadgetWidth(1), GadgetHeight(1), GetSysColor_(#COLOR_3DFACE))
StopDrawing()
EndIf
SetGadgetText(1, "this text was not changed correctly!")
EndSelect
...
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal & srod.
You guys are cool. Maybe someday we can meet to share a dozen of beers or something.
BTW, gnozal, your example works fine except that I'm using an image as a background for a window:
And I need to display this image behind the components when needed so I can't use the system's color not even draw by myself.
I noticed something strange: if you have a container and set the container to #PureColor_DontSetbackColor the background image will start from the window top and left and will not draw the part of the image behind the container, leaving the container's background a little misplaced.
I'll post some minimal code showing that. Thanks for being so friendly and helpful. Guys like you are hard to find on message boards.
You guys are cool. Maybe someday we can meet to share a dozen of beers or something.

BTW, gnozal, your example works fine except that I'm using an image as a background for a window:
Code: Select all
brush = CreatePatternBrush_(ImageID(imgBackground))
SetClassLong_(WindowID(#wMain), #GCL_HBRBACKGROUND, brush)
I noticed something strange: if you have a container and set the container to #PureColor_DontSetbackColor the background image will start from the window top and left and will not draw the part of the image behind the container, leaving the container's background a little misplaced.
I'll post some minimal code showing that. Thanks for being so friendly and helpful. Guys like you are hard to find on message boards.
Proud registered Purebasic user.
Because programming should be fun.
Because programming should be fun.
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Works here ?Rook Zimbabwe wrote:Very small issue:
If I have a multiline button and I color it... it is NO LONGER multiline!!!![]()
Is ther a workaround?
Code: Select all
Enumeration
#Window_0
EndEnumeration
Enumeration
#Button_0
EndEnumeration
Define.l Event, EventWindow, EventGadget, EventType, EventMenu
Procedure OpenWindow_Window_0()
If OpenWindow(#Window_0, 450, 200, 400, 400, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
If CreateGadgetList(WindowID(#Window_0))
ButtonGadget(#Button_0, 125, 85, 170, 45, "Line 1" + #CrLf$ + "Line 2", #PB_Button_MultiLine)
PureCOLOR_SetButtonColor(#Button_0, $FF, #PureCOLOR_SystemColor)
EndIf
EndIf
EndProcedure
OpenWindow_Window_0()
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
If EventGadget = #Button_0
EndIf
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = #Window_0
CloseWindow(#Window_0)
Break
EndIf
EndSelect
Forever
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Update (all versions)
Changes :
- Icon menus now also work with WinNT4 [tested Win9x/WinNT4/WinXP]
- Added MenuTabAlign parameter to PureCOLOR_SetMenuOptions() : tabbed menu text alignment (#DT_RIGHT, #DT_LEFT, #DT_CENTER) [default is #DT_RIGHT])
Changes :
- Icon menus now also work with WinNT4 [tested Win9x/WinNT4/WinXP]
- Added MenuTabAlign parameter to PureCOLOR_SetMenuOptions() : tabbed menu text alignment (#DT_RIGHT, #DT_LEFT, #DT_CENTER) [default is #DT_RIGHT])
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
Well in your example I only say Line1 and not Line2
I have tried this with UNICODE and NOT UNICODE

HMMM? I don't know... now I did tell it to use different colors when clicked etc.
Compiler is set to produce UNICODE
When off the buttons have color but no text...
ALSO... when I turned on threadsafe I get a nasty popup window that says:

I have tried this with UNICODE and NOT UNICODE

Code: Select all
Enumeration
#Window_0
EndEnumeration
Enumeration
#Button_0
EndEnumeration
Define.l Event, EventWindow, EventGadget, EventType, EventMenu
Procedure OpenWindow_Window_0()
If OpenWindow(#Window_0, 450, 200, 400, 400, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
If CreateGadgetList(WindowID(#Window_0))
ButtonGadget(#Button_0, 125, 85, 170, 45, "Line 1 we only see 1 line of text on the button and we are sing UNICODE", #PB_Button_MultiLine)
; PureCOLOR_SetButtonColor(#Button_0, $FF, #PureCOLOR_SystemColor)
PureCOLOR_SetButtonColor(#Button_0, RGB(255,255,255), RGB(180,0,0), RGB(255,127,0), RGB(255,255,0))
EndIf
EndIf
EndProcedure
OpenWindow_Window_0()
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
If EventGadget = #Button_0
EndIf
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = #Window_0
CloseWindow(#Window_0)
Break
EndIf
EndSelect
ForEver

HMMM? I don't know... now I did tell it to use different colors when clicked etc.

Compiler is set to produce UNICODE
When off the buttons have color but no text...
ALSO... when I turned on threadsafe I get a nasty popup window that says:
POLINK: error: Unresolved external symbol '_PB_StringBasePosition'.
POLINK: Fatal Error: 1 unresolved external(s.)

-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
You mean you see line 1 and not line 2 if you compile my code example ?Rook Zimbabwe wrote:Well in your example I only say Line1 and not Line2
And if you increase the gadget height ?
Anyway, #PB_Button_MultiLine currently only works if you use #CrLf$.Rook Zimbabwe wrote:ButtonGadget(#Button_0, 125, 85, 170, 45, "Line 1 we only see 1 line of text on the button and we are sing UNICODE", #PB_Button_MultiLine)
Did you use the adapted subsystem ?Rook Zimbabwe wrote:POLINK: error: Unresolved external symbol '_PB_StringBasePosition'.
POLINK: Fatal Error: 1 unresolved external(s.)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
#CrLf$
Crap! That will make it unusable in most instances... My program allows the user to change the text on the buttons. Auto line length is a must.
Yes... I only see the text that says Line 1
Crap! That will make it unusable in most instances... My program allows the user to change the text on the buttons. Auto line length is a must.
You mean you see line 1 and not line 2 if you compile my code example ?
Yes... I only see the text that says Line 1
Still line 1... I have tried it both with the UNICODE off and ON and also both with the UNICODE LIB and Regular LIB. (4 ways tried it!)And if you increase the gadget height ?
Umm.... I don't know... What is it?Did you use the adapted subsystem ?