PureCOLOR library : coloring gadgets (and much more)

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

Moderator: gnozal

kinglestat
Enthusiast
Enthusiast
Posts: 746
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Post by kinglestat »

yes, you are right (as usual)
I guess I am too dependant on your update prog :(
I may not help with your coding
Just ask about mental issues!

http://www.lulu.com/spotlight/kingwolf
http://www.sen3.net
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

kinglestat wrote:yes, you are right (as usual)
I guess I am too dependant on your update prog :(
It should download the PureCOLOR 4.10 library if you checked 'For PB 4.1x' ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

gnozal,

I'm using your purecolor and purelvsort libraries. I color the lines with PureCOLOR_SetRowColor() and I use both sorting and filtering.

I noticed two things. One, if the listicon is currently showing colored lines and the user types something in the filterbar, the colors will disappear.

Second, in the same situation as above, sorting does not keep the row colors with the row. The rows sort but the colored lines don't move.

I'm using 4.10 because (a different issue) seems to prevent me from using the filtering function in 4.20.

Thanks!
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Xombie wrote:I noticed two things. One, if the listicon is currently showing colored lines and the user types something in the filterbar, the colors will disappear.
Second, in the same situation as above, sorting does not keep the row colors with the row. The rows sort but the colored lines don't move.
Did you try using the cell coloring callback ?

Code: Select all

PureCOLOR_SetCellColorCallback(WindowNumber.l, *ProcedureAddress)
It is much faster than the specialized functions and should (I hope) not show the same issues with sorting.
The callback procedure is like this :

Code: Select all

Procedure MyCellColorCallback(GadgetNumber.l, CellRow.l, CellColumn.l, *TextColor.LONG, *BackColor.LONG, *FontID.LONG)
 ;
 ; Do Stuff
 ;
EndProcedure
So you can colorize / change font any cell / row / column.
Of course, after sorting the rows may have changed and this is not traced by PureLVSORT nor by PureCOLOR.

Note : there are some issues with PB 4.20 beta and 'tailbiten' user librairies. I hope they will be fixed.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

gnozal,

I tried that and it worked great. .... until I had to move the listicon into a containergadget->panelgadget. Now it seems like the callback isn't being called anymore. Are you aware of any issues for when the listicon is not using the actual window as it's immediate parent?
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Xombie wrote:I tried that and it worked great. .... until I had to move the listicon into a containergadget->panelgadget. Now it seems like the callback isn't being called anymore. Are you aware of any issues for when the listicon is not using the actual window as it's immediate parent?
Did you 'register' the listicon before setting the callback ? If not, PureCOLOR doesn't subclass the gadget nor it's parents.

Code: Select all

Enumeration
  #Window_0
EndEnumeration
Enumeration
  #Panel_0
  #ListIcon_1
EndEnumeration
Define.l Event, EventWindow, EventGadget, EventType, EventMenu
Procedure MyCellColorCallback(GadgetNumber.l, CellRow.l, CellColumn.l, *TextColor.Long, *BackColor.Long, *FontID.Long) 
  Debug "MyCellColorCallback() !"
  *BackColor\l = #Blue
  *TextColor\l = #White
EndProcedure

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))
      PanelGadget(#Panel_0, 25, 35, 365, 300)
        AddGadgetItem(#Panel_0, -1, "Tab #1")
        ListIconGadget(#ListIcon_1, 5, 15, 345, 250, "Gadget_1", 100, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
        AddGadgetColumn(#ListIcon_1, 1, "Column #2", 100)
        AddGadgetColumn(#ListIcon_1, 2, "Column #3", 100)
        SendMessage_(GadgetID(#ListIcon_1), #LVM_SETCOLUMNWIDTH, 0, #LVSCW_AUTOSIZE_USEHEADER)
        SendMessage_(GadgetID(#ListIcon_1), #LVM_SETCOLUMNWIDTH, 1, #LVSCW_AUTOSIZE_USEHEADER)
        SendMessage_(GadgetID(#ListIcon_1), #LVM_SETCOLUMNWIDTH, 2, #LVSCW_AUTOSIZE_USEHEADER)
        AddGadgetItem(#ListIcon_1, -1, "A" + Chr(10) + "B" + Chr(10) + "C")
        AddGadgetItem(#ListIcon_1, -1, "A" + Chr(10) + "B" + Chr(10) + "C")
        AddGadgetItem(#ListIcon_1, -1, "A" + Chr(10) + "B" + Chr(10) + "C")
        AddGadgetItem(#ListIcon_1, -1, "A" + Chr(10) + "B" + Chr(10) + "C")
      CloseGadgetList()
    EndIf
  EndIf
EndProcedure

OpenWindow_Window_0()

PureCOLOR_SetGadgetColor(#ListIcon_1, #PureCOLOR_SystemColor, #PureCOLOR_SystemColor) ; just to register the gadget !!!
PureCOLOR_SetCellColorCallback(#Window_0,  @MyCellColorCallback())

Repeat
  Event = WaitWindowEvent()
  Select Event
    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).
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

Argh, yeah. That was exactly what was needed.

Thanks again for your help and patience, gnozal!
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Update V14.01

Changes :
- fixed some issues with XP themes
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 V14.02

Changes :
- fixed WM_SETTEXT event for colored buttons
- enhanced multiline support for colored buttons : lines are automatically broken between words if a word would extend past the edge of the button. A CrLf also breaks the line. Note that the button must have the #PB_Button_MultiLine style.
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 »

Gnozal... this is soooo much better! I am truly imnpressed.

I do see some sort of issue in the text placement. It is not always set off at the same angle or placement.

Look at this uncolored example:
Image

When the buttons are colored the text moves around and not in the same way. Some text is truncated with a "..." hyperbole mark. Some text is exactly the same, and some text has an invisible line at the top.

Image

I clear all color from the buttons before coloring them because the button text determines the color (at the moment.) then I simply check button text and color certain buttons. Is there something I can do to justify the text better?

8)
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:Gnozal... this is soooo much better! I am truly imnpressed.
I simply fixed a bug ... DrawText_() almost does it all.
Rook Zimbabwe wrote:I do see some sort of issue in the text placement. It is not always set off at the same angle or placement.
When the buttons are colored the text moves around and not in the same way. Some text is truncated with a "..." hyperbole mark. Some text is exactly the same, and some text has an invisible line at the top.
Is there something I can do to justify the text better?
I am doing 2 things :
1. I am using DrawText_() with this flags :
DT_WORDBREAK : lines are automatically broken between words if a word would extend past the edge of the button. A CrLf also breaks the line.
DT_END_ELLIPSIS : replace characters at the end of the string with ellipses if necessary, so that the result fits in the available space
2. Additionally, I do a vertical centering based on the number of lines. Maybe I can improve this one.

A hint : in order to have the same text placement for colored and uncolored buttons, you could color the uncolored buttons with #PureCOLOR_SystemColor.
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 V14.03

Changes :
- improved multiline support for colored buttons (again)
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 »

OK that seems to have it working...

Now, two things:

#1. What installer are you using for this program, looks interesting?
#2. Where is the donate link on that web page of yours!
8)
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:#1. What installer are you using for this program, looks interesting?
It's a custom made library installer : http://www.purebasic.fr/english/viewtopic.php?t=18514
Rook Zimbabwe wrote:#2. Where is the donate link on that web page of yours!
There isn't. No paypal account.
But thank you very much.
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 »

This is what it looks like now. I can stand the ellipses on that button.

Image

Gnozal... You need a donate link. I haven't made much with mine but people are using that silly little FREEPOS and the restaurant POS and some have even donated $5 - $11

It bought me a beer for my work!

8)
Binarily speaking... it takes 10 to Tango!!!

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