
Egrid 3.0 grid control (replaced by egrid 4)
Update (now Beta 2) : - 5 Sept 2006.
2 bugs fixed; one (minor) with the selection box not rendering correctly and one (major) with the detection of clicks within check box cells before a cell had been selected.
Please see the first post for the download link.
2 bugs fixed; one (minor) with the selection box not rendering correctly and one (major) with the detection of clicks within check box cells before a cell had been selected.
Please see the first post for the download link.
I may look like a mule, but I'm not a complete ass.
Update: - 8 Sept 2006.
1 bug fixed; when a column was prohibited from being resized, the sizing cursor would occasionally still appear.
Please see the first post for the download link.
I'm now using this library quite heavily and are thus finding the more subtle bugs. Now at beta 3 which I hope should be the last.

1 bug fixed; when a column was prohibited from being resized, the sizing cursor would occasionally still appear.
Please see the first post for the download link.
I'm now using this library quite heavily and are thus finding the more subtle bugs. Now at beta 3 which I hope should be the last.

I may look like a mule, but I'm not a complete ass.
-
- Enthusiast
- Posts: 746
- Joined: Fri Jul 14, 2006 8:53 pm
- Location: Malta
- Contact:
I Have tried the egrid and looks really cool.
But I seem to be stuck in a bug or unwanted practice
I am trying to make grid to show and add records in a small database...where the default db entries are static (user cannot change them) but can add additional records. the code below. But when I add a new row to the grid, the
SetGadgetItemText ( #GGrid, gLastRow, Str ( gLastRow ), 1 )
SetGadgetItemText ( #GGrid, gLastRow, "bobby", 2 )
SetGadgetItemText ( #GGrid, gLastRow, "coulthard", 3 )
dont work
any clues ?
Procedure.l MyCellCallBack ( egrid, uMsg, *cellinfo.egridCellInfo )
Protected result
Select uMsg
Case #egrid_NotifyCellType
;If ( *cellinfo\column = 1 ) Or ( *cellinfo\row < #ValidationCount )
If ( *cellinfo\row < #ValidationCount )
*cellinfo\celltype = #egrid_StaticString
EndIf
Case #egrid_cellupdated
result = #True
Case #egrid_FormatCell
;*cellinfo\font = FontID(1)
If ( *cellinfo\row % 2 )
*cellinfo\backcolour = $E1282B ; Dark blue
*cellinfo\forecolour = $E7FDDE ; Light grey
Else
*cellinfo\backcolour = $898989 ; Grey
*cellinfo\forecolour = $21F6F7 ; Yellow
;*cellinfo\backcolour = $D1E92E ; Cyan
;*cellinfo\forecolour = $39F7F3 ; Yellow
EndIf
If *cellinfo\column = 1
*cellinfo\textjustification = #egrid_CenterText
EndIf
Default
result = #True
EndSelect
ProcedureReturn result
EndProcedure
Procedure ValidationPanel ()
Protected RS.SQLite3_Recordset
Protected sSQL.s
Protected i.l
If IsGadget ( #GContainer )
FreeGadget ( #GContainer )
EndIf
gActiveWindow = #MNUValidation
gLastRow = 0
ContainerGadget ( #GContainer, #AppMyX, #AppMyY, #AppMySizeX - ( 2 * #AppMyX ), #AppMySizeY - 54, #PB_Container_Raised )
;ContainerGadget ( #GContainer, #AppMyX, #AppMyY, #AppMySizeX - ( 2 * #AppMyX ), #AppMySizeY - 54, #PB_Container_Double )
egrid_CreateGrid ( #GGrid, #AppMyX, #AppMyY, ( #AppMySizeX - ( 2 * #AppMyX ) ) - 20, #AppMySizeY - 94, 18, #PB_ListIcon_GridLines, #egrid_ResizeColumnsTrue )
egrid_CreateCellCallback ( #GGrid, @MyCellCallBack() )
ButtonGadget ( #GAddButton, #AppMyX, #ButtonPosY, #ButtonSizeX, #ButtonSizeY, "Add Record" )
ButtonGadget ( #GDelButton, #AppMyX + 100, #ButtonPosY, #ButtonSizeX, #ButtonSizeY, "Delete Record" )
AddGadgetColumn ( #GGrid, 1, "ID", 40 )
AddGadgetColumn ( #GGrid, 2, "Description", 100 )
AddGadgetColumn ( #GGrid, 3, "Data", 300 )
sSQL = "SELECT id, description, data from validation order by id"
If SQLite3_GetRecordset ( sSQL, dbHandler, @RS )
If RS\Handle
i = 0
While RS\EOF = 0
AddGadgetItem ( #GGrid, -1, "" )
SQLite3_GetRecordsetValueByName ( "id", @RS )
SetGadgetItemText ( #GGrid, i, RS\sValue, 1 )
SQLite3_GetRecordsetValueByName ( "description", @RS )
SetGadgetItemText ( #GGrid, i, RS\sValue, 2 )
SQLite3_GetRecordsetValueByName ( "data", @RS )
SetGadgetItemText ( #GGrid, i, RS\sValue, 3 )
SQLite3_RecordsetMoveNext ( @RS )
i + 1
Wend
gLastRow = i
EndIf
Else
MessageRequester ( MyAppName, SQLite3_GetLastMessage() )
EndIf
;CloseGadgetList () ; remarked as I'm not sure if should b eenabled or not
EndProcedure
and when Add button pressed
gLastRow + 1
AddGadgetItem ( #GGrid, gLastRow, "" )
SetGadgetItemText ( #GGrid, gLastRow, Str ( gLastRow ), 1 )
SetGadgetItemText ( #GGrid, gLastRow, "bobby", 2 )
SetGadgetItemText ( #GGrid, gLastRow, "coulthard", 3 )
cheers
Terence
But I seem to be stuck in a bug or unwanted practice
I am trying to make grid to show and add records in a small database...where the default db entries are static (user cannot change them) but can add additional records. the code below. But when I add a new row to the grid, the
SetGadgetItemText ( #GGrid, gLastRow, Str ( gLastRow ), 1 )
SetGadgetItemText ( #GGrid, gLastRow, "bobby", 2 )
SetGadgetItemText ( #GGrid, gLastRow, "coulthard", 3 )
dont work
any clues ?
Procedure.l MyCellCallBack ( egrid, uMsg, *cellinfo.egridCellInfo )
Protected result
Select uMsg
Case #egrid_NotifyCellType
;If ( *cellinfo\column = 1 ) Or ( *cellinfo\row < #ValidationCount )
If ( *cellinfo\row < #ValidationCount )
*cellinfo\celltype = #egrid_StaticString
EndIf
Case #egrid_cellupdated
result = #True
Case #egrid_FormatCell
;*cellinfo\font = FontID(1)
If ( *cellinfo\row % 2 )
*cellinfo\backcolour = $E1282B ; Dark blue
*cellinfo\forecolour = $E7FDDE ; Light grey
Else
*cellinfo\backcolour = $898989 ; Grey
*cellinfo\forecolour = $21F6F7 ; Yellow
;*cellinfo\backcolour = $D1E92E ; Cyan
;*cellinfo\forecolour = $39F7F3 ; Yellow
EndIf
If *cellinfo\column = 1
*cellinfo\textjustification = #egrid_CenterText
EndIf
Default
result = #True
EndSelect
ProcedureReturn result
EndProcedure
Procedure ValidationPanel ()
Protected RS.SQLite3_Recordset
Protected sSQL.s
Protected i.l
If IsGadget ( #GContainer )
FreeGadget ( #GContainer )
EndIf
gActiveWindow = #MNUValidation
gLastRow = 0
ContainerGadget ( #GContainer, #AppMyX, #AppMyY, #AppMySizeX - ( 2 * #AppMyX ), #AppMySizeY - 54, #PB_Container_Raised )
;ContainerGadget ( #GContainer, #AppMyX, #AppMyY, #AppMySizeX - ( 2 * #AppMyX ), #AppMySizeY - 54, #PB_Container_Double )
egrid_CreateGrid ( #GGrid, #AppMyX, #AppMyY, ( #AppMySizeX - ( 2 * #AppMyX ) ) - 20, #AppMySizeY - 94, 18, #PB_ListIcon_GridLines, #egrid_ResizeColumnsTrue )
egrid_CreateCellCallback ( #GGrid, @MyCellCallBack() )
ButtonGadget ( #GAddButton, #AppMyX, #ButtonPosY, #ButtonSizeX, #ButtonSizeY, "Add Record" )
ButtonGadget ( #GDelButton, #AppMyX + 100, #ButtonPosY, #ButtonSizeX, #ButtonSizeY, "Delete Record" )
AddGadgetColumn ( #GGrid, 1, "ID", 40 )
AddGadgetColumn ( #GGrid, 2, "Description", 100 )
AddGadgetColumn ( #GGrid, 3, "Data", 300 )
sSQL = "SELECT id, description, data from validation order by id"
If SQLite3_GetRecordset ( sSQL, dbHandler, @RS )
If RS\Handle
i = 0
While RS\EOF = 0
AddGadgetItem ( #GGrid, -1, "" )
SQLite3_GetRecordsetValueByName ( "id", @RS )
SetGadgetItemText ( #GGrid, i, RS\sValue, 1 )
SQLite3_GetRecordsetValueByName ( "description", @RS )
SetGadgetItemText ( #GGrid, i, RS\sValue, 2 )
SQLite3_GetRecordsetValueByName ( "data", @RS )
SetGadgetItemText ( #GGrid, i, RS\sValue, 3 )
SQLite3_RecordsetMoveNext ( @RS )
i + 1
Wend
gLastRow = i
EndIf
Else
MessageRequester ( MyAppName, SQLite3_GetLastMessage() )
EndIf
;CloseGadgetList () ; remarked as I'm not sure if should b eenabled or not
EndProcedure
and when Add button pressed
gLastRow + 1
AddGadgetItem ( #GGrid, gLastRow, "" )
SetGadgetItemText ( #GGrid, gLastRow, Str ( gLastRow ), 1 )
SetGadgetItemText ( #GGrid, gLastRow, "bobby", 2 )
SetGadgetItemText ( #GGrid, gLastRow, "coulthard", 3 )
cheers
Terence
Well you haven't supplied me any code that I can actually run!
The only thing that immediately comes to mind, is the value of #ValidationCount. Now this is a fixed, immutable value and it seems to me that this could cause some problems.
If poking around with this doesn't help, then you might have to pm me, to e-mail me the entire code, sqlite database as well.
Incidentally, egrid 3 is going to be trashed very soon as egrid 4 (a complete rewrite which should be compatible with all existing code) will hit the decks within the next day or so.
egrid 3 is based on old code which is creaking and groaning under the weight of all the dirty scumy hacks!
I'll have a go at integrating your callback in some code of mine to see if I can get it working.
**EDIT:
I've just run some almost identical code and it works fine. I really think that the value of #ValidationCount is causing all cells to be static.
The only thing that immediately comes to mind, is the value of #ValidationCount. Now this is a fixed, immutable value and it seems to me that this could cause some problems.
If poking around with this doesn't help, then you might have to pm me, to e-mail me the entire code, sqlite database as well.
Incidentally, egrid 3 is going to be trashed very soon as egrid 4 (a complete rewrite which should be compatible with all existing code) will hit the decks within the next day or so.
egrid 3 is based on old code which is creaking and groaning under the weight of all the dirty scumy hacks!
I'll have a go at integrating your callback in some code of mine to see if I can get it working.
**EDIT:
I've just run some almost identical code and it works fine. I really think that the value of #ValidationCount is causing all cells to be static.
I may look like a mule, but I'm not a complete ass.
-
- Enthusiast
- Posts: 746
- Joined: Fri Jul 14, 2006 8:53 pm
- Location: Malta
- Contact:
geez
you had already answerred
I wanted to post before so you dont waste any time
sorry about that
actually bug is in my code
I was modifieng on the wrong line....ie I was adding lastrow before updating the text gadget
AddGadgetItem ( #GGrid, -1, "" )
SetGadgetItemText ( #GGrid, gLastRow, Str ( gLastRow + 1 ), 1 )
gLastRow + 1
I realized after I wrote the delete code
cheers
Terence
you had already answerred
I wanted to post before so you dont waste any time
sorry about that
actually bug is in my code
I was modifieng on the wrong line....ie I was adding lastrow before updating the text gadget
AddGadgetItem ( #GGrid, -1, "" )
SetGadgetItemText ( #GGrid, gLastRow, Str ( gLastRow + 1 ), 1 )
gLastRow + 1
I realized after I wrote the delete code
cheers
Terence
Hello Stephen,
I have integrated egrid in my application and it is very impressive. There are only two things which I have mentioned:
Does 'HideGadget()' work properly? Here it seems to be a grey box after this command, and unfortunately my window is not grey
.
And I did not have success yet with right mouseclick, which should cause the egrid to disappear.
But besides this it is a great work.
I have integrated egrid in my application and it is very impressive. There are only two things which I have mentioned:
Does 'HideGadget()' work properly? Here it seems to be a grey box after this command, and unfortunately my window is not grey

And I did not have success yet with right mouseclick, which should cause the egrid to disappear.
But besides this it is a great work.