Not sure what you mean, although I suspect your callback is at fault.
Can you p.m. the code to me please?
**EDIT: a quick test; works okay here.
The following seems to do what you're after. It's a bit of a hack at the minute and, if you type into a cell in the shaded column, you might see some re-colouring problems (the same kind of problems which you might see in your own code).
This is not a bug and is simply due to the fact that egrid is not equipped to change the colour of a cell whilst you are physically typing into the cell itself. However, having said this, the CellCallback function can easily remedy this. Let's concentrate on the sort issue first however.
Code: Select all
DisableExplicit
;*****************************************FONT DATA****************************************
Enumeration
#head1
#head2
#main
EndEnumeration
;******************************************************************************************
Procedure.l MyCellCallBack(egrid, uMsg, *cellinfo.egridCellInfo)
Protected result
Static oldcol, oldrow
Select uMsg
Case #egrid_FormatCell
If *cellinfo\column=2
If egrid_GetCellText(1, 2, *cellinfo\row)="1"
*cellinfo\backcolour=#Yellow
EndIf
EndIf
Default
result = #True ;This accounts for all messages we have decided not to process.
EndSelect
ProcedureReturn result
EndProcedure
;******************************************************************************************
;*************************************WINDOW + GADGET LIST*********************************
If OpenWindow(0,0,0,640,300,"egrid4 demo 5.",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_Maximize|#PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
;******************************************************************************************
;********************************************EGRID*****************************************
;Create an egrid with resizable columns.
egrid_CreateGrid(1, WindowWidth(0)/4, WindowHeight(0)/8, WindowWidth(0)/2, WindowHeight(0)/2,28,#egrid_HeaderDragDrop|#egrid_Gridlines, #egrid_ResizeColumnsTrue)
;******************************************************************************************
egrid_CreateCellCallback(1, @MyCellCallBack())
egrid_SetHeaderHeight(1, 26)
egrid_setOption(1, #egrid_HeaderBorderColour, #Red)
egrid_setOption(1, #egrid_SelectionBorderColour, #Blue)
egrid_setOption(1, #egrid_SelectionBorderWidth, 2)
;********************************************TEXT GADGET***********************************
;***************************************ADD COLUMNS AND ROWS TO EGRID**********************************
For b=0 To 4
egrid_AddColumn(1,b,"Col " + Str(b),60)
Next
egrid_AddRows(1,-1, 100)
For b=0 To 4
egrid_SetCellText(1, 2,b, "1")
Next
PureLVSORT_SelectGadgetToSort(1,#PureLVSORT_ShowClickedHeader_Text)
;*****************************************EVENT LOOP***************************************
Repeat
EventID = WaitWindowEvent()
Select EventID
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
Until EventID = #PB_Event_CloseWindow
EndIf
End
I may look like a mule, but I'm not a complete ass.