Page 1 of 2
Grid gadget (egrid ver 1.1) complete - update 1.1b.
Posted: Fri Oct 14, 2005 3:04 am
by srod
**EDIT**
Have fixed a couple of bugs and added a couple of functions for pasting from the clipboard.
Apart from fixing bugs, I do not anticipate working on this project for some time now. Time to move on!
Well, this turned out to be quite an undertaking. I almost drowned in the depths of the API to get this working right!
In short, an egrid is a good old grid gadget which offers quite a lot of customising (colouring of cells, data validation, live updates to a database etc.) and gives the developer a lot of control over user actions and so on.
I've put in a huge effort to eliminate the problems of flicker which is hugely apparent when you colour the cells of a ListIcon gadget and then scroll through the control. This is caused by windows erasing the background with just a single colour as opposed to the many colours which may be present throughout the control.
At the moment, only text can be entered into the cells of an egrid. However, even this version uses quite a bit of custom draw and it is only a matter of time before I upgrade this work to full custom draw, which should then allow various controls to be embedded within the cells of each grid.
The only thing I haven't added is multiple cell selection by click-and-drag etc. I left this out deliberately as I think it will get in the way of the full custom draw version. I will probably add this for the next version.
I've included a few demo programs and a full user guide.
For some reason Tailbite crashes when I try to create a user library out of the source. If anyone has any ideas on that score I'll be more than interested to hear.
Regards.
http://www.purecoder.net/purebasic/egrid.zip
***MINOR UPDATE: A few more issues related to flickering whilst scrolling have been addressed.***
Posted: Fri Oct 14, 2005 5:08 am
by rsts
very nice effect.
I believe i can use this in a password program i've written.
thanks for sharing.
Posted: Fri Oct 14, 2005 5:28 am
by zikitrake
srod,
It works perfectly and is really simple to implement.
Thanks!
Posted: Fri Oct 14, 2005 10:08 am
by El_Choni
I'll have a look at that problem.
Re: Grid gadget (egrid ver 1.1) complete.
Posted: Fri Oct 14, 2005 10:39 am
by gnozal
srod wrote:For some reason Tailbite crashes when I try to create a user library out of the source. If anyone has any ideas on that score I'll be more than interested to hear.
Don't know if this helps, but some stuff has to be in the _Init procedure, like NewList() for example.
Posted: Fri Oct 14, 2005 10:42 am
by srod
Thanks.
El-Choni, thanks for looking. I was going to ask if you'd have the time to rummage through and find the problem, as I'd quite like to turn this into a user library. My knowledge of c is functional at best and so Tailbite is my best hope on that score!
Posted: Fri Oct 14, 2005 10:52 am
by srod
Gnozal wrote:Don't know if this helps, but some stuff has to be in the _Init procedure, like NewList() for example.
:roll:
Doh!
Thanks for the tip, I'll see if that sorts it out.
***EDIT:***
No, I've chucked all the initialising stuff into an _Init procedureDLL, but still Tailbite crashes out with the Windows send error dialogue.
Posted: Fri Oct 14, 2005 5:40 pm
by Thorsten1867
I think, I've found a bug.
Code: Select all
Select uMsg
Case #egrid_InsertChar
If *cellinfo\column = 2
note = Val(*cellinfo\text)
If note >= 1 And note <= 6
Result = #True
Else
Result = #False
EndIf
EndIf
. . . . . .
EndSelect
The variable 'note' seem to return always '0' (=> '*cellinfo\text' is always "")
Posted: Fri Oct 14, 2005 10:27 pm
by srod
Thorsten, no bug, you're misusing the *cellinfo structure.
With the
message, the 'text' field of the *cellinfo structure contains a copy of ALL the text in the cell being edited BEFORE the newly entered character is added. The ascii value of the newly pressed key is in the 'param' field.
Assuming then that you're attempting to just allow the user to enter digits 1 to 6, use the following:
Code: Select all
Case #egrid_InsertChar
If *cellinfo\column = 2
note = Val(chr(*cellinfo\param))
If note >= 1 And note <= 6
Result = #True
Else
Result = #False
EndIf
EndIf
Regards.
***By the way, I have just uploaded an update which resolves a few more issues related to 'flickering.
Posted: Sat Oct 15, 2005 10:38 am
by Thorsten1867
Thanks! I 've used the old version before and not noticed the changes in the structure. But now it works really fine in my program.
I don't know, what I would do without your 'egrid'.
Thorsten (Germany)
PS: Sorry for my bad english.
Posted: Sun Oct 16, 2005 12:00 am
by srod
***BUG FIX***
On further testing, 3 bugs identified and now fixed. 2 regarding erasing the background, 1 with the CellCallback function. Please download the fixed version.
Update 1.1a released.
Posted: Mon Oct 17, 2005 11:52 pm
by srod
Version 1.1a adds a new message for the optional CellCallback function and a command allowing the pasting of data from the clipboard into a range of cells. Data can thus, for example, be copied from a selection of cells in Excel and pasted directly into an egrid.
Regards.
http://www.purecoder.net/purebasic/egrid.zip
Wish List
Posted: Tue Oct 18, 2005 3:50 pm
by CSAUER
Pretty good grid-control.
My wish-list:
- After editing and pressing RETURN-key, the cursor-position should be visible and moving with arrow-keys should be possible
- Multi-field selection, cut/copy content via Clipboard (CTRL+X and CTRL+C)
- Input content from clipboard via CTRL+V (or SHIFT+INSERT)
- Row-Sorting (combined with GNOZAL PureVLSort)
- Display checkboxes for true/false values
- Implement Drop-Down-Input, Checkbox-Input
- Implement Cell-Icons
- Maybe Hierachical Grid like MS FlexGrid with Input (idea: ListView together with TreeView)
Thanks in advance.
CSAUER
Posted: Fri Oct 21, 2005 3:27 pm
by srod
After editing and pressing RETURN-key, the cursor-position should be visible and moving with arrow-keys should be possible
Trivial to implement, may do that today.
Multi-field selection, cut/copy content via Clipboard (CTRL+X and CTRL+C)
Have already commented upon this one and it should be in the next version. I wasn't sure whether I wanted this feature myself.
Input content from clipboard via CTRL+V (or SHIFT+INSERT)
No, this would be treading upon the toes of the developer using egrids. I have implemented a function which allows pasting from the clipboard (and will soon add another). It is up to the developer whether he/she wishes to tie these functions to CTRL+V menu options. It would be one simple line of code, but as I say, not all programs would require this feature and so I leave it to the individual developer.
Row-Sorting (combined with GNOZAL PureVLSort)
Interesting. May well add this.
- Implement Drop-Down-Input, Checkbox-Input
- Implement Cell-Icons
- Maybe Hierachical Grid like MS FlexGrid with Input (idea: ListView together with TreeView)
As already commented, this first version of egrids was basically to see if I was up to the job etc. The next major version (which I am close to starting) will feature complete 'custom draw' techniques which should allow the first two of your 'wishes' here. Not sure what you mean with the last one, but remember that an egrid is based upon a ListIcon gadget and as such, there will come a point where the limitations of using this control begin to tell. I like the idea of embedding egrids within egrids, but I think that will require the creation of custom controls not based upon a ListIcon. Kind of like Xombie's impressive 'xgrid' which probably offers greater flexibility.
Anyhow, thanks for your observations, they are much appreciated. I will keep working on this.
Posted: Sun Oct 23, 2005 7:30 pm
by Thorsten1867
Is it possible automatical activate the cell for editing direct after moving to it? (After selection I have to click on it , before I can insert text.)