Page 9 of 35

Posted: Wed Sep 14, 2005 1:50 pm
by gnozal
DoubleDutch wrote:Is it possible soon? :D
It is :lol:

Posted: Wed Sep 14, 2005 3:03 pm
by DoubleDutch
Good! :D

Posted: Thu Sep 15, 2005 7:51 am
by gnozal
Library update

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
End

Posted: Thu Sep 15, 2005 8:05 am
by srod
This library is simply awesome.

Great work.

Posted: Thu Sep 15, 2005 10:09 am
by DoubleDutch
Fred should beg to let it be included in the official distribution... :D

-Anthony

Posted: Thu Sep 15, 2005 1:20 pm
by rsts
As I've said before - the guy's a PB genious.

Thanks again for all your contributions.

Posted: Tue Nov 01, 2005 9:47 am
by gnozal
Update

Changes
- New function : PureCOLOR_GetCellColor()

Posted: Mon Nov 07, 2005 10:46 am
by gnozal
Update

Changes :
- fixed problem with multiline StringGadget [ viewtopic.php?t=17598 ]

Posted: Mon Nov 07, 2005 11:30 am
by RichardL
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)

Posted: Mon Nov 07, 2005 11:40 am
by gnozal
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.
The cells colors are not stored the same way if you use SetCellColor() or SetRow/ColumnColor().
RichardL wrote: A suggestion...
GetRowColor() would solve my problem, or GetCellColor() should always return the colour, even if defined by SetRowColor()
Ok, I will add this to GetCellColor().

Posted: Mon Nov 07, 2005 12:12 pm
by RichardL
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?

Posted: Mon Nov 07, 2005 12:13 pm
by gnozal
Update

Changes :
- changed PureCOLOR_GetCellColor() : get the listicon cell color, set with the PureCOLOR SetCellColor() / SetColumnColor() / SetRowColor() functions.
See previous post.

Posted: Mon Nov 07, 2005 12:17 pm
by gnozal
RichardL wrote:I also note that if a cell is coloured SetRowColor() does not over-ride the cell colour. Was this intentional?
Yes, it's by design.
See the help file :
The coloring priority is Cells > Columns > Rows.
I had to define a priority. It's the order the coloring functions are called in the callback.

Posted: Mon Nov 07, 2005 12:18 pm
by RichardL
Thank you... An excellent library just got better.

Posted: Mon Nov 07, 2005 4:18 pm
by RichardL
Here is a snip of code from my current project; which tests the feeders used for PCB assembly pick-and-place machines.

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