Grid gadget (egrid ver 1.1) complete - update 1.1b.
Grid gadget (egrid ver 1.1) complete - update 1.1b.
**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.***
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.***
Last edited by srod on Sun Oct 23, 2005 3:40 pm, edited 3 times in total.
I may look like a mule, but I'm not a complete ass.
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: Grid gadget (egrid ver 1.1) complete.
Don't know if this helps, but some stuff has to be in the _Init procedure, like NewList() for example.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.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
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!
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!
I may look like a mule, but I'm not a complete ass.
:roll:Gnozal wrote:Don't know if this helps, but some stuff has to be in the _Init procedure, like NewList() for example.
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.
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 think, I've found a bug.
The variable 'note' seem to return always '0' (=> '*cellinfo\text' is always "")
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
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:
Regards.
***By the way, I have just uploaded an update which resolves a few more issues related to 'flickering.
With the
Code: Select all
#egrid_InsertChar
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
***By the way, I have just uploaded an update which resolves a few more issues related to 'flickering.
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
Update 1.1a released.
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
Regards.
http://www.purecoder.net/purebasic/egrid.zip
I may look like a mule, but I'm not a complete ass.
Wish List
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
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
Trivial to implement, may do that today.After editing and pressing RETURN-key, the cursor-position should be visible and moving with arrow-keys should be possible
Have already commented upon this one and it should be in the next version. I wasn't sure whether I wanted this feature myself.Multi-field selection, cut/copy content via Clipboard (CTRL+X and CTRL+C)
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.Input content from clipboard via CTRL+V (or SHIFT+INSERT)
Interesting. May well add this.Row-Sorting (combined with GNOZAL PureVLSort)
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.- Implement Drop-Down-Input, Checkbox-Input
- Implement Cell-Icons
- Maybe Hierachical Grid like MS FlexGrid with Input (idea: ListView together with TreeView)
Anyhow, thanks for your observations, they are much appreciated. I will keep working on this.
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