Page 28 of 35

Posted: Sun Jul 06, 2008 8:25 pm
by Marco2007
...I use a Cellcallback in my app.
I have no problems with all other gadgets colored with PureColor.

Here`s a snippet of the callback:

Code: Select all

IncludePath "..\Source\"
  XIncludeFile "EsGRID.pbi"
IncludePath ""

Enumeration
  #head1
  #head2
  #main
EndEnumeration
LoadFont(#main, "Arial", 30)

Procedure.l MyCellCallBack(egrid, uMsg, *cellinfo.egridCellInfo)
  Protected result
  Static oldcol, oldrow

  Select uMsg
    Case #egrid_FormatCell
      If *cellinfo\row=-1 ;Custom header.
        If *cellinfo\column>=0 And *cellinfo\column<=29
          *cellinfo\forecolour = #Black
          *cellinfo\backcolour = #Red
          *cellinfo\borderstyles=#egrid_TopThickSolid|#egrid_BottomThickSolid 
      ;EndIf  
        Else
          *cellinfo\backcolour=#White
        EndIf 
      EndIf 
      If Not (*cellinfo\row)%2
        If *cellinfo\column>=0 And *cellinfo\column<=17
          *cellinfo\backcolour=#Red
        Else
          *cellinfo\backcolour=#White
        EndIf 
      EndIf 
  
        Default 
      result = #True                       ;This accounts for all messages we have decided not to process.
  EndSelect
  ProcedureReturn result
EndProcedure

If OpenWindow(0,0,0,640,300,"EsGRID demo 1.",#PB_Window_SystemMenu|#PB_Window_MaximizeGadget|#PB_Window_Maximize|#PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
    
  egrid_CreateGrid(1, WindowWidth(0)/4, WindowHeight(0)/8, WindowWidth(0)/2, WindowHeight(0)/2,42,0, #egrid_GridLines|#egrid_ResizeColumnsTrue|#egrid_MultiLineText)
  egrid_CreateCellCallback(1, @MyCellCallBack())
  egrid_SetHeaderHeight(1, 42)
  egrid_SetOption(1, #egrid_SelectionBorderWidth, 2)
  For b=0 To 49 ;50 columns. 
    egrid_AddColumn(1,b,"Col " + Str(b),100)
  Next
  egrid_AddRows(1,-1, 100) ;Add 100 rows.
  
  OptionGadget(4, 4, 4, 145, 20, "Test 1")
  PureCOLOR_SetGadgetColor(4, RGB(0,50,50), RGB(220,220,220)) ; without this -> no problem
  
 Repeat
    EventID = WaitWindowEvent()
    
    Select EventID
      
      Case #PB_Event_Gadget
    EndSelect
  Until EventID = #PB_Event_CloseWindow
  
EndIf
  
End


...the color will be shown, when a cell has been selected :(

Posted: Sun Jul 06, 2008 8:31 pm
by srod
Sorry, I understand the problem now. I don't use PureColor so cannot run your code.

Switching to pm.

Posted: Sun Jul 06, 2008 8:45 pm
by srod
Okay, I downloaded PureCOLOR and ran your example.

The problem is that if PureCOLOR subclasses the parent of the EsGRID after EsGRID does, then PureCOLOR is being a little naughty and not passing some notifications back to my subclass proc! :wink: Specifically it is not passing lots of instances of #NM_CUSTOMDRAW messages which EsGRID relies upon.

Either we bully Gnozal into ensuring that these notifications are passed back in the event that the underlying control has not been registered with PureCOLOR, or we, by means of a quick fix, ensure that EsGRID gets to subclass the parent after PureCOLOR does :

Code: Select all

IncludePath "..\Source\" 
  XIncludeFile "EsGRID.pbi" 
IncludePath "" 

Enumeration 
  #head1 
  #head2 
  #main 
EndEnumeration 
LoadFont(#main, "Arial", 30) 

Procedure.l MyCellCallBack(egrid, uMsg, *cellinfo.egridCellInfo) 
  Protected result 
  Static oldcol, oldrow 

  Select uMsg 
    Case #egrid_FormatCell 
      If *cellinfo\row=-1 ;Custom header. 
        If *cellinfo\column>=0 And *cellinfo\column<=29 
          *cellinfo\forecolour = #Black 
          *cellinfo\backcolour = #Red 
          *cellinfo\borderstyles=#egrid_TopThickSolid|#egrid_BottomThickSolid 
      ;EndIf  
        Else 
          *cellinfo\backcolour=#White 
        EndIf 
      EndIf 
      If Not (*cellinfo\row)%2 
        If *cellinfo\column>=0 And *cellinfo\column<=17 
          *cellinfo\backcolour=#Red 
        Else 
          *cellinfo\backcolour=#White 
        EndIf 
      EndIf 
  
        Default 
      result = #True                       ;This accounts for all messages we have decided not to process. 
  EndSelect 
  ProcedureReturn result 
EndProcedure 

If OpenWindow(0,0,0,640,300,"EsGRID demo 1.",#PB_Window_SystemMenu|#PB_Window_MaximizeGadget|#PB_Window_Maximize|#PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0)) 
    
  OptionGadget(4, 4, 4, 145, 20, "Test 1") 
  PureCOLOR_SetGadgetColor(4, #Red, RGB(220,220,220)) ; without this -> no problem 

  egrid_CreateGrid(1, WindowWidth(0)/4, WindowHeight(0)/8, WindowWidth(0)/2, WindowHeight(0)/2,42,0, #egrid_GridLines|#egrid_ResizeColumnsTrue|#egrid_MultiLineText) 
  egrid_CreateCellCallback(1, @MyCellCallBack()) 
  egrid_SetHeaderHeight(1, 42) 
  egrid_SetOption(1, #egrid_SelectionBorderWidth, 2) 
  For b=0 To 49 ;50 columns. 
    egrid_AddColumn(1,b,"Col " + Str(b),100) 
  Next 
  egrid_AddRows(1,-1, 100) ;Add 100 rows. 
  
  
 Repeat 
    EventID = WaitWindowEvent() 
    
    Select EventID 
      
      Case #PB_Event_Gadget 
    EndSelect 
  Until EventID = #PB_Event_CloseWindow 
  
EndIf 
  
End

Posted: Sun Jul 06, 2008 9:11 pm
by Marco2007
Thanx! I can live with that :D

Posted: Mon Sep 08, 2008 4:57 pm
by gnozal
Num3 wrote:PureColor is now bugged with the updated Listicongadgets!

Code: Select all

PureCOLOR_SetGadgetColorEx(#Gadget_main_listtrab, #PureCOLOR_SystemColor,#PureCOLOR_SystemColor, RGB(255, 255, 223), #PureCOLOR_LV_AlternateColors)
Disables gridlines!!!
You have to use a workaround (setting the #LVS_EX_GRIDLINES style manually), because since PB4.20 beta gadget library ownerdraw is used for the gridlines (thanks Fred for the info).

Code: Select all

Enumeration 
  #Window_0 
EndEnumeration 
Enumeration 
  #ListIcon_0 
EndEnumeration 
Define.l Event, EventWindow, EventGadget, EventType, EventMenu 
Procedure OpenWindow_Window_0() 
  If OpenWindow(#Window_0, 450, 200, 400, 215, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar) 
    If CreateGadgetList(WindowID(#Window_0))
      ListIconGadget(#ListIcon_0, 16, 17, 375, 191, "Gadget_0", 100, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect) 
      ;
      ; workaround, because since PB4.20 beta gadget library PB uses ownerdraw for the gridlines
      #LVS_EX_GRIDLINES = 1
      SendMessage_(GadgetID(#ListIcon_0), #LVM_SETEXTENDEDLISTVIEWSTYLE, #LVS_EX_GRIDLINES, #LVS_EX_GRIDLINES)
      ;
      AddGadgetColumn(#ListIcon_0, 1, "Column #2", 100) 
      AddGadgetColumn(#ListIcon_0, 2, "Column #3", 100) 
      AddGadgetItem(#ListIcon_0, -1, "x" + Chr(10) + "x" + Chr(10) + "x") 
      AddGadgetItem(#ListIcon_0, -1, "x" + Chr(10) + "x" + Chr(10) + "x") 
      AddGadgetItem(#ListIcon_0, -1, "x" + Chr(10) + "x" + Chr(10) + "x") 
      AddGadgetItem(#ListIcon_0, -1, "x" + Chr(10) + "x" + Chr(10) + "x") 
      AddGadgetItem(#ListIcon_0, -1, "x" + Chr(10) + "x" + Chr(10) + "x") 
      AddGadgetItem(#ListIcon_0, -1, "x" + Chr(10) + "x" + Chr(10) + "x") 
      SendMessage_(GadgetID(#ListIcon_0), #LVM_SETCOLUMNWIDTH, 0, #LVSCW_AUTOSIZE_USEHEADER) 
      SendMessage_(GadgetID(#ListIcon_0), #LVM_SETCOLUMNWIDTH, 1, #LVSCW_AUTOSIZE_USEHEADER) 
      SendMessage_(GadgetID(#ListIcon_0), #LVM_SETCOLUMNWIDTH, 2, #LVSCW_AUTOSIZE_USEHEADER) 
      ;
      PureCOLOR_SetGadgetColorEx(#ListIcon_0, #PureCOLOR_SystemColor,#PureCOLOR_SystemColor, RGB(255, 255, 223), #PureCOLOR_LV_AlternateColors)
      
    EndIf 
  EndIf 
EndProcedure 

OpenWindow_Window_0() 

Repeat 
  Event = WaitWindowEvent() 
  Select Event 
    Case #PB_Event_CloseWindow 
      EventWindow = EventWindow() 
      If EventWindow = #Window_0 
        CloseWindow(#Window_0) 
        Break 
      EndIf 
  EndSelect 
ForEver

Posted: Wed Dec 03, 2008 11:45 am
by DoubleDutch
Gnozal: I realise that you have previously said that your going to wait until 4.30 final, but with the final PB4.30 almost with us (b5 or RC1 is here now) - I don't think there will be anything left that could 'break' your libs. Do you think you could do an early release?

Posted: Thu Dec 04, 2008 12:18 pm
by gnozal
DoubleDutch wrote:I don't think there will be anything left that could 'break' your libs.
Only Fre[d|ak] knows.
DoubleDutch wrote:Do you think you could do an early release?
Will see.

Posted: Sat Dec 20, 2008 2:01 am
by PHP
gnozal please update the lib! the final is out and many of my programs don't work anymore :(

Posted: Sat Dec 20, 2008 3:47 am
by DoubleDutch
The libs are updated. Check out the site. :)

Posted: Mon Dec 22, 2008 2:30 pm
by gnozal
Yes, I was away for 1 week, but I recompiled all libs with PB4.30 beta 5 before leaving.

Posted: Sun Jun 07, 2009 2:49 pm
by iostream
I think i found a bug...

When I use a window-menu and a popup-menu, they don't work together:
The 1st menutitle of the window-menu appears in the popup-menu.
This effect only appears when I create the popup first and the window-menu later.

Code: Select all

Enumeration
   #M
   #MP
EndEnumeration

If OpenWindow(0, 0, 0, 330, 220, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    CreatePopupMenu(#MP)
       PureCOLOR_MenuItem(#MP, 1, "popup 1")
       PureCOLOR_MenuItem(#MP, 2, "popup 2")
       MenuBar()
       PureCOLOR_MenuItem(#MP, 3, "popup 3")
    PureCOLOR_ActivateColoredPopUpMenu(#MP, 0)
    PureCOLOR_SetPopUpOfficeStyle(#MP, 0)

    CreateMenu(#M, WindowID(0))
    MenuTitle("Datei")
       PureCOLOR_MenuItem(#M, 4, "menu 1")
       PureCOLOR_MenuItem(#M, 5, "menu 2")
       MenuBar()
       PureCOLOR_MenuItem(#M, 6, "menu 3")
    PureCOLOR_ActivateColoredMenu(#M)
    PureCOLOR_SetOfficeStyle(#M)
   
    Repeat
      event = WaitWindowEvent()
          Select event
               Case #WM_RBUTTONUP
                DisplayPopupMenu(#MP, WindowID(0))
             Case #PB_Event_CloseWindow
                Break
          EndSelect
     ForEver
EndIf

End
If i create the window-menu first and the popup later, all menutitles in the window-menu contains weird signs.

Greetings
iostream

Posted: Tue Jun 09, 2009 10:01 am
by gnozal
iostream wrote:When I use a window-menu and a popup-menu, they don't work together:
The 1st menutitle of the window-menu appears in the popup-menu.
This effect only appears when I create the popup first and the window-menu later.
Sorry, this is currently a limitation of PureCOLOR ; you can't have a menu and a popup menu with the same parent window.
I may change this when I have some time.

You could use this workaround :

Code: Select all

Enumeration 
  #M 
  #MP 
EndEnumeration 

If OpenWindow(1, 0, 0, 0, 0, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered |#PB_Window_Invisible) 
  CreatePopupMenu(#MP) 
  PureCOLOR_MenuItem(#MP, 1, "popup 1") 
  PureCOLOR_MenuItem(#MP, 2, "popup 2") 
  MenuBar() 
  PureCOLOR_MenuItem(#MP, 3, "popup 3") 
  PureCOLOR_ActivateColoredPopUpMenu(#MP, 1) 
  PureCOLOR_SetPopUpOfficeStyle(#MP, 1) 
EndIf

If OpenWindow(0, 0, 0, 330, 220, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
  
  CreateMenu(#M, WindowID(0)) 
  MenuTitle("Datei") 
  PureCOLOR_MenuItem(#M, 4, "menu 1") 
  PureCOLOR_MenuItem(#M, 5, "menu 2") 
  MenuBar() 
  PureCOLOR_MenuItem(#M, 6, "menu 3") 
  PureCOLOR_ActivateColoredMenu(#M) 
  PureCOLOR_SetOfficeStyle(#M) 
  
  Repeat 
    event = WaitWindowEvent() 
    Select event 
      Case  #PB_Event_Menu      
        Debug EventMenu() 
      Case #WM_RBUTTONUP 
        DisplayPopupMenu(1, WindowID(0)) 
      Case #PB_Event_CloseWindow 
        Break 
    EndSelect 
  ForEver 
EndIf 

End

Posted: Tue Jun 09, 2009 10:36 am
by iostream
Sorry, this is currently a limitation of PureCOLOR ; you can't have a menu and a popup menu with the same parent window.
Thanks for the info, your workaround works fine :wink:

Posted: Fri Jun 26, 2009 3:12 pm
by User_Russian
iostream wrote:I think i found a bug...

When I use a window-menu and a popup-menu, they don't work together:
The 1st menutitle of the window-menu appears in the popup-menu.
This effect only appears when I create the popup first and the window-menu later.
Use library XP_Menu_Lib http://www.purebasic.fr/english/viewtop ... sc&start=0

Posted: Fri Jun 26, 2009 4:13 pm
by gnozal
User_Russian wrote:Use library XP_Menu_Lib http://www.purebasic.fr/english/viewtop ... sc&start=0
Thanks for advertising, unfortunately XP_Menu_Lib doesn't work on all Windows platforms, as I already reported.