egrid-2 gadget - REMOVED (see version 3 - separate thread.)
egrid-2 gadget - REMOVED (see version 3 - separate thread.)
REMOVED.
Prior to an all new version being released.
Prior to an all new version being released.
Last edited by srod on Mon Sep 04, 2006 12:41 pm, edited 6 times in total.
I may look like a mule, but I'm not a complete ass.
Update - improved performance. 3rd September 2006.
Having finally gotten round to using this control within a commercial application, it provided the motivation to address a few long standing issues to do with flicker etc.
Have spent a good few hours hacking the code about and seem to have massively reduced problems of flicker, particularly when using gridlines. This has also improved the responsiveness of the grids.
It is possible though that I've now introduced other bugs as the code is quite complex (and probably in need of a rewrite! That's for another day though!
) so please let me know if you find anything out of the ordinary.
See the first post for the download link.
Having finally gotten round to using this control within a commercial application, it provided the motivation to address a few long standing issues to do with flicker etc.
Have spent a good few hours hacking the code about and seem to have massively reduced problems of flicker, particularly when using gridlines. This has also improved the responsiveness of the grids.
It is possible though that I've now introduced other bugs as the code is quite complex (and probably in need of a rewrite! That's for another day though!

See the first post for the download link.
I may look like a mule, but I'm not a complete ass.
Hi srod. This is excellent work, really useful. Thanks alot!
I'm a newcomer to egrid (I see it's had some history) and to list gadgets in general, so please excuse my basic comments, questions & suggestions.
I notice it is possible to use the TAB key to move forward, but there seems to be no way to move back - perhaps using Shift-TAB to move back one column is good?
It is good that one can use the up/down arrow keys to change the combo-box values, but there seems to be no way to update a checkbox value via a keyboard? At least, space bar to toggle check on/off would be good.
Using the mouse to update values, I am not sure about the need to click once to select, then click again to edit, e.g. 2 clicks are required to change a checkbox value, whereas in the PB help example for listicon with checkbox, it is possible to click directly on a cell containing a checkbox to change its value (i.e. click once). Same could be said for select/editing combo-box & text. Is it possible to make it so one click directly on the cell is enough to go into 'edit mode' (or see the combo-box options immediately)?
I also wonder about double-clicking the 'between-part' of the column header (when the cursor changes to a column width resizer) i.e. whether this action should auto-expand the column width to match the text width in the same column, but I think the regular listicon doesn't do this either.
Thanks again for making this great grid implementation available.
I'm a newcomer to egrid (I see it's had some history) and to list gadgets in general, so please excuse my basic comments, questions & suggestions.
I notice it is possible to use the TAB key to move forward, but there seems to be no way to move back - perhaps using Shift-TAB to move back one column is good?
It is good that one can use the up/down arrow keys to change the combo-box values, but there seems to be no way to update a checkbox value via a keyboard? At least, space bar to toggle check on/off would be good.
Using the mouse to update values, I am not sure about the need to click once to select, then click again to edit, e.g. 2 clicks are required to change a checkbox value, whereas in the PB help example for listicon with checkbox, it is possible to click directly on a cell containing a checkbox to change its value (i.e. click once). Same could be said for select/editing combo-box & text. Is it possible to make it so one click directly on the cell is enough to go into 'edit mode' (or see the combo-box options immediately)?
I also wonder about double-clicking the 'between-part' of the column header (when the cursor changes to a column width resizer) i.e. whether this action should auto-expand the column width to match the text width in the same column, but I think the regular listicon doesn't do this either.
Thanks again for making this great grid implementation available.
Thanks.mskuma wrote:Hi srod. This is excellent work, really useful. Thanks alot!
Consider yourself excused!I'm a newcomer to egrid (I see it's had some history) and to list gadgets in general, so please excuse my basic comments, questions & suggestions.

Uhm, I'll think about that one....but there seems to be no way to update a checkbox value via a keyboard? At least, space bar to toggle check on/off would be good.
This is the way I designed it I'm afraid and it suits me and my applications. I'm reluctant to alter this, although it would be a relatively simple adjustment to make. Tabbing (or pushing enter) between cells being edited keeps Egrid in 'edit' mode.Using the mouse to update values, I am not sure about the need to click once to select, then click again to edit, e.g. 2 clicks are required to change a checkbox value, whereas in the PB help example for listicon with checkbox, it is possible to click directly on a cell containing a checkbox to change its value (i.e. click once).
The answer is yes, using a 'CellCallBack' function.Same could be said for select/editing combo-box & text. Is it possible to make it so one click directly on the cell is enough to go into 'edit mode' (or see the combo-box options immediately)?
Whoops, that's a bug which is now fixed.I also wonder about double-clicking the 'between-part' of the column header (when the cursor changes to a column width resizer) i.e. whether this action should auto-expand the column width to match the text width in the same column, but I think the regular listicon doesn't do this either.

I've now found a quite major bug which I will endeavour to fix over the next couple of hours, so I will upload again when the fix is complete. Strange, this bug has been here since the beginning but has eluded me 'til now!Thanks again for making this great grid implementation available.
Regards.
I may look like a mule, but I'm not a complete ass.
I could imagine that. It doesn't matter when you're mainly viewing the content, but if there were lots of edits, I think it would become quite tedious. I'd suggest a mode changing flag at the top of the program (the current mode, or 'single click' (to focus/enter-edit) mode. I wonder if the latter is the usual GUI/editing style for other windows apps (given the PB native operation, I assume it is the usual manner so in that case, this style is tending to work against what people might be used to. On the other hand, if it works for your current applications & users, I can't argue with either).srod wrote:This is the way I designed it I'm afraid and it suits me and my applications.
OK. If it's not tedious, maybe it's enough (instead of the flag idea above). I'll look into that.Same could be said for select/editing combo-box & text. Is it possible to make it so one click directly on the cell is enough to go into 'edit mode' (or see the combo-box options immediately)?srod wrote:The answer is yes, using a 'CellCallBack' function.
Thanks for your reply.
Was this fix included in the latest version? I'm wondering whether double-click expands to the width of the widest datavalue in the column, or to the width of the column (ala Excel)?srod wrote:Whoops, that's a bug which is now fixed.I also wonder about double-clicking the 'between-part' of the column header (when the cursor changes to a column width resizer) i.e. whether this action should auto-expand the column width to match the text width in the same column, but I think the regular listicon doesn't do this either.![]()
Sorry.. I'm not sure what was actually the problem - what was the issue? I can't immediately see any improvement (briefly looked at the 2nd demo, tabbing across columns).FIXED!!! (Swine tabstops! ) See above for details.
Thanks.
No, the problem was that if the Egrid lost focus by activating another gadget and then you hit the tab button, the egrid then regained the focus and went into edit mode! It was easily overlooked but created some barmy effects!
Have completed an example which shows how to enable one-click edit.
I will p.m. it to you.
Regards.
Have completed an example which shows how to enable one-click edit.
I will p.m. it to you.
Regards.
I may look like a mule, but I'm not a complete ass.
Yes it is included and columns resize to accomodate the widest value (this is simply the default for a ListIcon).Was this fix included in the latest version? I'm wondering whether double-click expands to the width of the widest datavalue in the column, or to the width of the column (ala Excel)?
I may look like a mule, but I'm not a complete ass.
- Thorsten1867
- Addict
- Posts: 1372
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
I'm interested to have a look to your example, too.srod wrote:Have completed an example which shows how to enable one-click edit.
I will p.m. it to you.
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Here she is:
Code: Select all
;******************************************************************************************
;'egrid' editable grid control. By Stephen Rodriguez.
;******************************************************************************************
;This example shows how to use a simple CellCallback function to enable one-click editing.
XIncludeFile "egrid.pb"
;The following simple CellCallback function allows us to enable one-click editing.
Procedure.l MyCellCallBack(egrid, uMsg, *cellinfo.egridCellInfo)
Protected result
Select uMsg
Case #egrid_SelectCell
;Check whether the cell was selected using the mouse.
If *cellinfo\param=#egrid_leftClick
egrid_HideEdit(egrid) ;Hides the selection border.
egrid_SelectCell(egrid, *cellinfo\row, *cellinfo\column, #True) ;Selects the cell.
;The '#True' value in the above line causes the selected cell to enter 'edit mode'.
result=#False ;No point getting the Egrid to select the cell as well.
Else
result=#True
EndIf
Default
result=#True
EndSelect
ProcedureReturn result
EndProcedure
;******************************************************************************************
;******************************************************************************************
;*************************************WINDOW + GADGET LIST*********************************
If OpenWindow(0,0,0,640,300,"One-click edit.",#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,21,#PB_ListIcon_GridLines, #egrid_ResizeColumnsTrue)
;******************************************************************************************
;**********************************SET CELLCALLBACK FUNCTION*******************************
;Set the callback early to avoid massive flickering when populating the egrid with initial data.
egrid_CreateCellCallback(1, @MyCellCallBack())
;******************************************************************************************
;***************************************ADD DATA TO EGRID**********************************
For b=1 To 50 ;50 columns. NOTE the column index begins at 1!
AddGadgetColumn(1,b,"Col " + Str(b),60)
Next
For b=0 To 9 ; Add 10 rows.
AddGadgetItem(1,-1,"") ;The "" is for the zero column which is always invisible in an egrid.
Next
For i = 0 To 9
For j = 1 To 50
SetGadgetItemText(1,i,"(" + Str(i) + ", "+Str(j) + ")",j)
Next j
Next i
;NOTE that the zero column of an egrid is blanked out, hence the "" in the above AddGadgetItem() command.
;******************************************************************************************
;*****************************************EVENT LOOP***************************************
Repeat
EventID = WaitWindowEvent()
Until EventID = #PB_Event_CloseWindow
EndIf
End
;******************************************************************************************
I may look like a mule, but I'm not a complete ass.
- Thorsten1867
- Addict
- Posts: 1372
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
An another thing:
Some users with Win98 have reported problems, if they use a window with an egrid included.
Have you an idea which WinAPI-function in eGrids don't work with Win98?
Some users with Win98 have reported problems, if they use a window with an egrid included.
Have you an idea which WinAPI-function in eGrids don't work with Win98?
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]