
egrid 4 grid gadget - (static PB library version.)
**UPDATE: 3 October 2006.
Added a threadsafe version to the download section.
Thanks to El-Choni and Gnozal (see one of the above posts for further tips from Gnozal).
http://www.purecoder.net/egrid.htm
Added a threadsafe version to the download section.
Thanks to El-Choni and Gnozal (see one of the above posts for further tips from Gnozal).
http://www.purecoder.net/egrid.htm
I may look like a mule, but I'm not a complete ass.
Hi srod
Are there any issues using unicode with this? I enabled the unicode compiler option and tried to compile the demo1.pb file, but got an 'Invalid memory access' error at the egrid_CreateGrid( line. Using unicode is a must for me personally, I hope it's possible.
Please consider implementing shift-tab to go backwards horizontally (opposite of going forwards using tab). Perhaps also Enter to go down (columnar) & shift-Enter to go up. This would make the grid nav nice for keyboard users familiar with Excel.
BTW in the zip file, the res file is actually 'egrid_Resident..res' (2 periods) - is that ok?
Are there any issues using unicode with this? I enabled the unicode compiler option and tried to compile the demo1.pb file, but got an 'Invalid memory access' error at the egrid_CreateGrid( line. Using unicode is a must for me personally, I hope it's possible.
Please consider implementing shift-tab to go backwards horizontally (opposite of going forwards using tab). Perhaps also Enter to go down (columnar) & shift-Enter to go up. This would make the grid nav nice for keyboard users familiar with Excel.
BTW in the zip file, the res file is actually 'egrid_Resident..res' (2 periods) - is that ok?
What mskuma said.
Or pretty close.
Questions (any solution, API or eGrid, acceptable):
Any way we can add functionality? Eg, trap/report key strokes outside of those enumerated, make certain keys automatically do something (like Shift-Tab go backwards).
Is there a way to let a user resize row height? Detect it and work with it, like a spreadsheet?
How can a cell be coloured to give a 3d look? Eg, make the left hand column cells look like the column headers, or get top/left borders slightly different colour to bottom/right.
And .. unicode support is pretty important, currently crashes as per mskuma's report. Windows XP pro here.
Sorry if I have missed some docs or something obvious. But I am stuck with the brain I currently have, no upgrades available for this old model.
Nice package, worth the $, BTW.

Questions (any solution, API or eGrid, acceptable):
Any way we can add functionality? Eg, trap/report key strokes outside of those enumerated, make certain keys automatically do something (like Shift-Tab go backwards).
Is there a way to let a user resize row height? Detect it and work with it, like a spreadsheet?
How can a cell be coloured to give a 3d look? Eg, make the left hand column cells look like the column headers, or get top/left borders slightly different colour to bottom/right.
And .. unicode support is pretty important, currently crashes as per mskuma's report. Windows XP pro here.
Sorry if I have missed some docs or something obvious. But I am stuck with the brain I currently have, no upgrades available for this old model.
Nice package, worth the $, BTW.
Dare2 cut down to size
Hi,
sorry for the delay in responding, but my computer is laying in bits at the moment whilst I 'persuade' the dvd writer to behave itself. It seems to have complied!
Unicode. At the moment, I don't think Tailbite will create a Unicode lib; although I could modify the Tailbite source again in the same way that I did (thanks to Gnozal) to create a threadsafe version.
To be honest, you'd probably be better off with the source code though if creating a unicode compliant app. I'll look into it.
I'll have a look at the shift tab this weekend. At the minute you can use ctrl/tab to alternate between editing a cell and simply navigating through cells. Combine this with the cursor keys and you can easily tab backwards through the grid.
Dare, I could arrange for every message passed to the list icon to be subsequently (or prior to) passed to the CellCallback function.
Crap, that's a damn fine idea actually; why the hell didn't that occur to me? Again, give me a couple of days as I'm on the move at the mo.
As for row height; the only way of changing individual row heights with a listicon is to utilise full owenerdrawn methods. The problem with this is that Windows then requires that I draw entire rows at a time as opposed to individual cells. This takes me down a very wayward path and really demands that I create a grid control not based upon a list icon (this is one for the future!)
As for making the first column appear similar to the header row; 2 options. Either remove the header row (set it's height to zero) and go from there, or wait until I've added button cell-types etc.

sorry for the delay in responding, but my computer is laying in bits at the moment whilst I 'persuade' the dvd writer to behave itself. It seems to have complied!

Unicode. At the moment, I don't think Tailbite will create a Unicode lib; although I could modify the Tailbite source again in the same way that I did (thanks to Gnozal) to create a threadsafe version.
To be honest, you'd probably be better off with the source code though if creating a unicode compliant app. I'll look into it.
I'll have a look at the shift tab this weekend. At the minute you can use ctrl/tab to alternate between editing a cell and simply navigating through cells. Combine this with the cursor keys and you can easily tab backwards through the grid.
Dare, I could arrange for every message passed to the list icon to be subsequently (or prior to) passed to the CellCallback function.
Crap, that's a damn fine idea actually; why the hell didn't that occur to me? Again, give me a couple of days as I'm on the move at the mo.

As for row height; the only way of changing individual row heights with a listicon is to utilise full owenerdrawn methods. The problem with this is that Windows then requires that I draw entire rows at a time as opposed to individual cells. This takes me down a very wayward path and really demands that I create a grid control not based upon a list icon (this is one for the future!)
As for making the first column appear similar to the header row; 2 options. Either remove the header row (set it's height to zero) and go from there, or wait until I've added button cell-types etc.

I may look like a mule, but I'm not a complete ass.
I'm wondering if we can colour the contents of a particular cell, i.e. either a different colour for the text, or failing that, a different background colour. This would aid in telling a user that a particular cell needs attention. (edit: ok I see it seems possible to do it via a callback, sorry).Dare wrote:How can a cell be coloured to give a 3d look?
I agree with the others - it seems like a good solution & looks like it's worth the pounds, but without unicode support, its appeal will be limited. This is like yet another appeal to get tailbite (or better still real in-IDE support for libs) that are unicode-compatible.
Last edited by mskuma on Sat Oct 07, 2006 9:09 am, edited 1 time in total.
I'm also wondering how this grid would go with very large number of rows? Has anyone got any reports?
I'm thinking of using this for a unicode app. It has a lot of rows to display. If the performance of displaying a lot of rows is not good (might not be the fault of egrid) I've got an idea to make a little interface widget that would appear on the left. It could be a tall rectangle representing the entire data, and then overlaid on that is a tiny rect which represents the portion you see on the egrid. If you drag the latter rect up or down, the content of the egrid (plus and minus some records) would appear. This might be a good add-on to egrid. I'd also like to make it so one-pixel rows in the tall rect could be coloured to flag some info to the user like 'this row needs attention', so the user's attention could be drawn to it, and drag the latter rect to scroll the dataset into view. If any tips to make it, I'd be glad to hear. Thanks.
[edit: on second thought, it was a dumb idea to suggest this kind of widget be incorporated.. it should be separate.]
I'm thinking of using this for a unicode app. It has a lot of rows to display. If the performance of displaying a lot of rows is not good (might not be the fault of egrid) I've got an idea to make a little interface widget that would appear on the left. It could be a tall rectangle representing the entire data, and then overlaid on that is a tiny rect which represents the portion you see on the egrid. If you drag the latter rect up or down, the content of the egrid (plus and minus some records) would appear. This might be a good add-on to egrid. I'd also like to make it so one-pixel rows in the tall rect could be coloured to flag some info to the user like 'this row needs attention', so the user's attention could be drawn to it, and drag the latter rect to scroll the dataset into view. If any tips to make it, I'd be glad to hear. Thanks.
[edit: on second thought, it was a dumb idea to suggest this kind of widget be incorporated.. it should be separate.]
Hi srod,
Glad your DVD writer got the message. Gotta let the hardware know who is boss!
The option to resize rows is not important, it is (for me, anyhow) a "nice but not essential" feature. In fact nothing I mentioned is really essential ..
.. except that without unicode I can't use it with one app (or within one suite, more accurately). If you do get it to unicode, it would be great, as I tend to use unicode as default these days, needed or not.
Anyway, looking forward to your next release.
Aside: Respect to anyone who modifies tailbite and wins!
@mskuma:
Your comments re native lib or obj creation is right on target. Couldn't agree more.
Glad your DVD writer got the message. Gotta let the hardware know who is boss!

The option to resize rows is not important, it is (for me, anyhow) a "nice but not essential" feature. In fact nothing I mentioned is really essential ..
.. except that without unicode I can't use it with one app (or within one suite, more accurately). If you do get it to unicode, it would be great, as I tend to use unicode as default these days, needed or not.
Anyway, looking forward to your next release.
Aside: Respect to anyone who modifies tailbite and wins!

@mskuma:
Your comments re native lib or obj creation is right on target. Couldn't agree more.
Dare2 cut down to size
With the alignment, I am at the mercy of Windows there. Windows passes the dimensions of the header cell and I am only permitted to draw within there. It's undoubtedly to do with the resizing borders etc. so I don't think there's a lot I can do on that score.
I've added the shift/tab that some have been requesting and it seems to work fine. (Unable to upload at the moment because my development machine has no access to the internet at my current location. Give me a few hours...)
I've tried compiling with unicode (straight forward compilation of source code - no Tailbite) and it just crashes out completely with non-sensical errors. Things like gadgetid's being too large when in fact they are equal to 1 ! Are there any PB issues with unicode that I should be aware of? I ask because my knowledge of unicode is very sketchy!
If someone is willing to help with this then I will provide the source code etc. and suitable recompense (if the said person manages to get it to work!
)
I've added the shift/tab that some have been requesting and it seems to work fine. (Unable to upload at the moment because my development machine has no access to the internet at my current location. Give me a few hours...)
I've tried compiling with unicode (straight forward compilation of source code - no Tailbite) and it just crashes out completely with non-sensical errors. Things like gadgetid's being too large when in fact they are equal to 1 ! Are there any PB issues with unicode that I should be aware of? I ask because my knowledge of unicode is very sketchy!

If someone is willing to help with this then I will provide the source code etc. and suitable recompense (if the said person manages to get it to work!

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
Problems with 'egrid_SelectedRow()':
If the gadget has not the focus (e.g. click on button 'Delete'), I get always '-1' as result.
If the gadget has not the focus (e.g. click on button 'Delete'), I get always '-1' as result.
Code: Select all
; Click on button 'Delete'
selected = egrid_SelectedRow(#eGridID)
If selected <> -1
egrid_RemoveRow(#eGridID, selected)
EndIf
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]
Not a bug, an inconvenience perhaps.
A while ago a request was made that, whenever an egrid loses focus, then the selection box should be hidden. I made the necessary adjustments.
Consequently, as soon as you hit the delete button, focus is lost, the selection box is removed and egrid_SelectedRow() returns -1 to indicate that there is no selection!
How about using a column of checkboxes and those which are checked get deleted when the user hits the delete button etc?
If this is a big problem then I'll reinstate the original functionality, but then the emphasise is on the developer to hide the selection box whenever another control receives the focus.
A while ago a request was made that, whenever an egrid loses focus, then the selection box should be hidden. I made the necessary adjustments.
Consequently, as soon as you hit the delete button, focus is lost, the selection box is removed and egrid_SelectedRow() returns -1 to indicate that there is no selection!

How about using a column of checkboxes and those which are checked get deleted when the user hits the delete button etc?
If this is a big problem then I'll reinstate the original functionality, but then the emphasise is on the developer to hide the selection box whenever another control receives the focus.
I may look like a mule, but I'm not a complete ass.