Page 1 of 2

egrid-2 gadget - REMOVED (see version 3 - separate thread.)

Posted: Sun Apr 09, 2006 10:41 pm
by srod
REMOVED.

Prior to an all new version being released.

Posted: Mon Apr 10, 2006 12:16 am
by rsts
Thanks to both of you.

cheers

Posted: Sat Sep 02, 2006 9:57 pm
by srod
**Small improvement** 2nd September 2006.

Have fixed a problem with resizing columns when a cell was selected within the first row. Now there are no problems with part of the selection border disappearing!

See first post for download.

Posted: Sun Sep 03, 2006 1:52 am
by srod
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.

Posted: Sun Sep 03, 2006 5:02 am
by mskuma
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.

Posted: Sun Sep 03, 2006 10:56 am
by srod
mskuma wrote:Hi srod. This is excellent work, really useful. Thanks alot!
Thanks.
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.
Consider yourself excused! :)
...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.
Uhm, I'll think about that one.
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).
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.
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)?
The answer is yes, using a 'CellCallBack' function.
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.
Whoops, that's a bug which is now fixed. :oops:
Thanks again for making this great grid implementation available.
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!

Regards.

Posted: Sun Sep 03, 2006 11:25 am
by mskuma
srod wrote:This is the way I designed it I'm afraid and it suits me and my applications.
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).
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.
OK. If it's not tedious, maybe it's enough (instead of the flag idea above). I'll look into that.

Thanks for your reply.

Posted: Sun Sep 03, 2006 11:30 am
by srod
I'll post an example, as soon as I've fixed this damn tabstop bug!

The swine is sending me nuts!

Posted: Sun Sep 03, 2006 11:57 am
by srod
FIXED!!! (Swine tabstops! :evil: ) See above for details.

Please download again (download link in the first post!)

Posted: Sun Sep 03, 2006 12:07 pm
by mskuma
srod wrote:
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.
Whoops, that's a bug which is now fixed. :oops:
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)?
FIXED!!! (Swine tabstops! ) See above for details.
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).

Thanks.

Posted: Sun Sep 03, 2006 12:15 pm
by srod
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.

Posted: Sun Sep 03, 2006 12:28 pm
by srod
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)?
Yes it is included and columns resize to accomodate the widest value (this is simply the default for a ListIcon).

Posted: Sun Sep 03, 2006 12:28 pm
by Thorsten1867
srod wrote:Have completed an example which shows how to enable one-click edit.
I will p.m. it to you.
I'm interested to have a look to your example, too.

Posted: Sun Sep 03, 2006 12:29 pm
by srod
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
;******************************************************************************************

Posted: Sun Sep 03, 2006 12:32 pm
by Thorsten1867
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?