PureCOLOR library : coloring gadgets (and much more)

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

User avatar
GG
Enthusiast
Enthusiast
Posts: 266
Joined: Tue Jul 26, 2005 12:02 pm
Location: Lieusaint (77), France

Post by GG »

Links are OK for me.
Purebasic 6.12 64 bits - Windows 11 Pro 64 bits 23H2
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> Links are OK for me

Yep, they're working now. Before I was getting errors of some sort, which
I assume were 404's but can't be sure as it wasn't in English. Had an image
of some girl's face.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

Is there any way to color a CheckBoxGadget's square with this? I couldn't
find anything in the Manual for it, and setting the BackColor for it only
changes the background of its text part.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

PB wrote:Is there any way to color a CheckBoxGadget's square with this?
No, sorry.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

For the future, perhaps?
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

PB wrote:For the future, perhaps?
Maybe :wink:
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

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
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).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

byo wrote:It's not working here:

Code: Select all

SetGadgetText(#txDicas, dica)
InvalidateRect_(WindowID(#wMain), rect, #True)
Unless there's something else to be done or I'm doing something wrong.

Thanks for the fast reply.
You could also draw on the window :

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).
byo
Enthusiast
Enthusiast
Posts: 635
Joined: Mon Apr 02, 2007 1:43 am
Location: Brazil

Post by byo »

gnozal & srod.

You guys are cool. Maybe someday we can meet to share a dozen of beers or something. :lol:

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)
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.
Proud registered Purebasic user.
Because programming should be fun.
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

Very small issue:

If I have a multiline button and I color it... it is NO LONGER multiline!!! :(

Is ther a workaround?
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

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?
Works here ?

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).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

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])
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

Well in your example I only say Line1 and not Line2

I have tried this with UNICODE and NOT UNICODE :D

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

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

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.)
:?:
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Rook Zimbabwe wrote:Well in your example I only say Line1 and not Line2
You mean you see line 1 and not line 2 if you compile my code example ?
And if you increase the gadget height ?
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)
Anyway, #PB_Button_MultiLine currently only works if you use #CrLf$.
Rook Zimbabwe wrote:POLINK: error: Unresolved external symbol '_PB_StringBasePosition'.
POLINK: Fatal Error: 1 unresolved external(s.)
Did you use the adapted subsystem ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

#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.
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
And if you increase the gadget height ?
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!)
Did you use the adapted subsystem ?
Umm.... I don't know... What is it?
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Post Reply