It isDoubleDutch wrote:Is it possible soon?
PureCOLOR library : coloring gadgets (and much more)
Moderator: gnozal
- DoubleDutch
- Addict

- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Good! 
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
-
gnozal
- PureBasic Expert

- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Library update
What's new :
- new function : PureCOLOR_SetMenuItemColors() ; see example below.
What's new :
- new function : PureCOLOR_SetMenuItemColors() ; see example below.
Code: Select all
Procedure.l WindowCallBack(WindowId.l, message.l, wParam.l, lParam.l)
ReturnValue.l = #PB_ProcessPureBasicEvents
;
ReturnValue = PureCOLOR_CallBack(WindowId, message, wParam, lParam, ReturnValue)
;
ProcedureReturn ReturnValue
EndProcedure
;
If OpenWindow(0, 10, 10, 300, 200, #PB_Window_ScreenCentered | #PB_Window_SystemMenu, "Ownerdraw MenuItems Demo")
SetWindowCallback(@WindowCallBack())
If CreateMenu(0, WindowID())
MenuTitle(" 1 ")
MenuItem(1, " 2 ")
MenuItem(2, " 3 ")
OpenSubMenu(" 4 ")
MenuItem(9, " 5 ")
OpenSubMenu(" 6 ")
MenuItem(10, " 7 ")
MenuItem(11, " 8 ")
CloseSubMenu()
CloseSubMenu()
MenuItem(3, " 9 ")
MenuItem(4, " 10 ")
MenuTitle(" 11 ")
MenuItem(5, " 12 ")
MenuItem(6, " 13 ")
EndIf
PureCOLOR_SetWindowColor(0, RGB(200, 255, 200))
; You have to define an owner drawn menu
PureCOLOR_SetMenuColors(0, #Red, RGB(200, 255, 200), #PureCOLOR_SystemColor, RGB(100, 255, 100))
; before you can set special colors for menu items
PureCOLOR_SetMenuItemColors(0, 7, #Red, RGB(255, 255, 255), #Yellow, #Blue)
PureCOLOR_SetMenuItemColors(0, 9, #Blue, RGB(255, 255, 255), #Red, #Yellow)
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
EndIf
EndFor free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
- DoubleDutch
- Addict

- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Fred should beg to let it be included in the official distribution... 
-Anthony
-Anthony
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
I was puzzeled when GetCellColor did not return the expected number (returned $ff000000); then I realized that I had coloured the whole line, not the cell I was inspecting.
A suggestion...
GetRowColor() would solve my problem, or GetCellColor() should always return the colour, even if defined by SetRowColor()
(My need is to flash an already coloured row ending up with the original colour)
A suggestion...
GetRowColor() would solve my problem, or GetCellColor() should always return the colour, even if defined by SetRowColor()
(My need is to flash an already coloured row ending up with the original colour)
-
gnozal
- PureBasic Expert

- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
The cells colors are not stored the same way if you use SetCellColor() or SetRow/ColumnColor().RichardL wrote:I was puzzeled when GetCellColor did not return the expected number (returned $ff000000); then I realized that I had coloured the whole line, not the cell I was inspecting.
Ok, I will add this to GetCellColor().RichardL wrote: A suggestion...
GetRowColor() would solve my problem, or GetCellColor() should always return the colour, even if defined by SetRowColor()
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Thanks, I think that would be a tidy solution.
I also note that if a cell is coloured SetRowColor() does not over-ride the cell colour. Was this intentional?
My personal vote would be that if a row was coloured it would overwrite the individual cell colours on that row; but my opinion is very much due to the job in hand... it could well be different next week! A flag maybe?
I also note that if a cell is coloured SetRowColor() does not over-ride the cell colour. Was this intentional?
My personal vote would be that if a row was coloured it would overwrite the individual cell colours on that row; but my opinion is very much due to the job in hand... it could well be different next week! A flag maybe?
-
gnozal
- PureBasic Expert

- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Update
Changes :
- changed PureCOLOR_GetCellColor() : get the listicon cell color, set with the PureCOLOR SetCellColor() / SetColumnColor() / SetRowColor() functions.
See previous post.
Changes :
- changed PureCOLOR_GetCellColor() : get the listicon cell color, set with the PureCOLOR SetCellColor() / SetColumnColor() / SetRowColor() functions.
See previous post.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
gnozal
- PureBasic Expert

- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Yes, it's by design.RichardL wrote:I also note that if a cell is coloured SetRowColor() does not over-ride the cell colour. Was this intentional?
See the help file :
I had to define a priority. It's the order the coloring functions are called in the callback.The coloring priority is Cells > Columns > Rows.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Here is a snip of code from my current project; which tests the feeders used for PCB assembly pick-and-place machines.
It works just fine but takes longer and longer to execute.
Disable the PureColor calls = 47mSec as many times as I like
With line and cell colouring I get progressively slower...
203
360
1219
2265
2813
3281
3765
4281
Any suggestions for what I might be doing wrong?
Code: Select all
Procedure ReWriteDisplay() ;- Refresh feeder data to screen
ColV = $FFFFFF ! $30 ; Line background colour value to use
SendMessage_(GadgetID(001),#WM_SETREDRAW, #False, 0) ; Turn off redraw until we have finished
ClearGadgetItemList(001) ; Clear the display
AddGadgetItem(1,0,"") ; ?
For n.w = 1 To MaxNumFeeders ; Typically 1000 units
AddGadgetItem(1,n.w,FeederData$(n.w)) ; Put data from array into display gadget
ColV ! $30 ; Toggle the background colour
PureCOLOR_SetRowColor (001,n.w, 0,ColV) ; Colour the line
PureCOLOR_SetCellColor(001,n.w,0,0,ColV) ; Set the first cell to match... so I can use GetCellColor()
If FeederFlags(n.w) ; If to be marked as defective...
PureCOLOR_SetCellColor(001,n.w,0,0,$8080FF) ; Colour the first cell light red
EndIf
Next
SendMessage_(GadgetID(001),#WM_SETREDRAW, #True, 0) ; Turn on redraw
While WindowEvent() : Wend ; Allow re-draw
EndProcedure
Disable the PureColor calls = 47mSec as many times as I like
With line and cell colouring I get progressively slower...
203
360
1219
2265
2813
3281
3765
4281
Any suggestions for what I might be doing wrong?
