egrid 4 grid gadget - (static PB library version.)
That will break quite a lot of code! I think Thorsten in particular will scream blue murder!
Although I know a search and replace will get around this.
However, ultimately egrid will be aimed at other language developers as well as PB and so I prefer to keep it the way it is - at least for now.
Thanks anyhow.
Although I know a search and replace will get around this.
However, ultimately egrid will be aimed at other language developers as well as PB and so I prefer to keep it the way it is - at least for now.
Thanks anyhow.
I may look like a mule, but I'm not a complete ass.
The unicode version looks like it works ok, at least a very simple test I did to read in & display 10 rows of Japanese text into the grid (based on demo 1 code). Good job!
When compiling as non-unicode against the unicode lib, a compile error will be observed (I guess that's kinda obvious). I wasn't sure if all the libs can co-exist in the libraries folder (I just copied the unicode one). When coming around to the doc, it's probably worth mentioning whether all or one lib can exist in the lib folder.
When compiling as non-unicode against the unicode lib, a compile error will be observed (I guess that's kinda obvious). I wasn't sure if all the libs can co-exist in the libraries folder (I just copied the unicode one). When coming around to the doc, it's probably worth mentioning whether all or one lib can exist in the lib folder.
No definitely not.
You could make use of PB subsystems and place the various libs in its own folder within the PB subsystem folder. From there you then need to enable the appropriate subsytem from within the PB ide depending on which version of the library you wish to use etc.
I'll add this to the help manual - as soon as I've added a help manual!
You could make use of PB subsystems and place the various libs in its own folder within the PB subsystem folder. From there you then need to enable the appropriate subsytem from within the PB ide depending on which version of the library you wish to use etc.
I'll add this to the help manual - as soon as I've added a help manual!

I may look like a mule, but I'm not a complete ass.
I'm populating an egrid using the egrid_AddRow() .. egrid_SetCellText() combination. Is there any way to set the cell text colour and/or background colour while I'm populating the grid? For example, something like:
Thanks.
Code: Select all
egrid_SetCellText(gadgetnum, columnindex, row, text.s, forecolour, backcolour)
No, sorry.
Such formatting is the domain of CellCallback functions. I made this decision about a year ago as it saves on memory usage as the egrid library itself does not store any info on colours, fonts etc. It means that inserting rows/columns will not cause problems in that the library has to keep track of all the formatting info. Such tracking would inevitably involve API lparam values and, as already seen with PB 4, Purebasic has a habit of breaking such code! In short, it means that changes to PB will not break this lib so easily!
Also, it means that the egrid lib is already part of the way towards offering 'virtual grids' which I think will eventually be an important requirement for some people.
As far as I can see, the advantages of this method far outweigh the disadvantages.
Having said this of course, there's no reason why you cannot code your own procedures which 'simulate' this functionality. Shouldn't be too difficult.
Such formatting is the domain of CellCallback functions. I made this decision about a year ago as it saves on memory usage as the egrid library itself does not store any info on colours, fonts etc. It means that inserting rows/columns will not cause problems in that the library has to keep track of all the formatting info. Such tracking would inevitably involve API lparam values and, as already seen with PB 4, Purebasic has a habit of breaking such code! In short, it means that changes to PB will not break this lib so easily!

Also, it means that the egrid lib is already part of the way towards offering 'virtual grids' which I think will eventually be an important requirement for some people.
As far as I can see, the advantages of this method far outweigh the disadvantages.
Having said this of course, there's no reason why you cannot code your own procedures which 'simulate' this functionality. Shouldn't be too difficult.
I may look like a mule, but I'm not a complete ass.
ok I see. Well I'm gonna be lazy here, and try something - I guess you're familiar with PureCOLOR. There is a function there called PureCOLOR_SetCellColor, as per:srod wrote:there's no reason why you cannot code your own procedures which 'simulate' this functionality. Shouldn't be too difficult.
Code: Select all
PureCOLOR_SetCellColor(ListIconNumber.l, Row.l, Column.l, TextColor.l, BackColor.l)

I am 99% sure that this will not work!
Nothing but respect for the PureCOLOR lib, but I really cannot see that it will be compatible with the egrid lib.
The text and background are all painted at the same time (obviously!
) even when no CellCallback is utilised. At no point do I allow Windows to paint any part of the cell or the text etc. The egrid lib also performs other 'tasks' at this time. There is no way of disabling the egrid 'paint process' and allowing another lib to take over.
You'd have to set this up so that egrid PureCOLOR painted cells after egrid and the result, at best, would be horrendous flicker. At worst this will simply crash your program. There's also the problem of text alignment.
In order to facilitate centered and right justified text in individual cells and allowing the editing of such text without alignment problems, I do not stick to the default 'cell margins' and this could result in the PureCOLOR lib (or Windows) superimposing a second copy of the cell text upon the first.
Allowing an app to disable the painting of cells by the egrid lib will be inviting all kinds of alignment issues (particularly with the different text justifications) etc.
Let me know what happens, but I'm not very optimistic on the chances of success!
**EDIT: as for getting the listicon gadget#, it's part of the egrid_CreateGrid() command. It is also returned by the egrid_CreateGrid() command (in case you use #Pb_Any etc.)
Nothing but respect for the PureCOLOR lib, but I really cannot see that it will be compatible with the egrid lib.
The text and background are all painted at the same time (obviously!

You'd have to set this up so that egrid PureCOLOR painted cells after egrid and the result, at best, would be horrendous flicker. At worst this will simply crash your program. There's also the problem of text alignment.
In order to facilitate centered and right justified text in individual cells and allowing the editing of such text without alignment problems, I do not stick to the default 'cell margins' and this could result in the PureCOLOR lib (or Windows) superimposing a second copy of the cell text upon the first.
Allowing an app to disable the painting of cells by the egrid lib will be inviting all kinds of alignment issues (particularly with the different text justifications) etc.
Let me know what happens, but I'm not very optimistic on the chances of success!

**EDIT: as for getting the listicon gadget#, it's part of the egrid_CreateGrid() command. It is also returned by the egrid_CreateGrid() command (in case you use #Pb_Any etc.)
I may look like a mule, but I'm not a complete ass.
Yeah I just tried the PureCOLOR function by simply using the gadget num as per the egrid number, and no colour change was seen. I didn't really expect it to work, but sometimes you never knowsrod wrote:Let me know what happens, but I'm not very optimistic on the chances of success!

(edit: it just occurred to me that maybe PureCOLOR is not unicode-compatible, so that might be a reason why it didn't work).
There's also the selection border. This is painted only when the cell is refreshed and is actually positioned 'inside' the cell as opposed to around the outside. Consequently, PureCOLOR would need to draw this as well!
Nice try however.
I guess the only way would be to subclass the egrid, disable #wm_paint, then initialise PureCOLOR etc.
You'd then need to take over the painting of the entire egrid however! Believe me, getting this even half decent has taken hours and hours and hours and hours and ...... staring at individual pixels wishing I could make them disappear!
I might add 'custom cells' in which the developer could paint the contents of the cell directly etc. But in terms of normal text cells, you could easily screw the alignment up etc.

Nice try however.
I guess the only way would be to subclass the egrid, disable #wm_paint, then initialise PureCOLOR etc.
You'd then need to take over the painting of the entire egrid however! Believe me, getting this even half decent has taken hours and hours and hours and hours and ...... staring at individual pixels wishing I could make them disappear!
I might add 'custom cells' in which the developer could paint the contents of the cell directly etc. But in terms of normal text cells, you could easily screw the alignment up etc.

I may look like a mule, but I'm not a complete ass.
If you're looking to make the package available for use with other languages, then customisation of look/style is likely to become a big thing (either as a selling point or as a niggle point, depending on whether it is possible or not).
Anyhow, that is just a passing thought. (or was it passing wind?
)
Anyhow, that is just a passing thought. (or was it passing wind?

Dare2 cut down to size
I'm not sure what you mean there Dare? There's already a lot of customisation possible.Dare wrote:If you're looking to make the package available for use with other languages, then customisation of look/style is likely to become a big thing (either as a selling point or as a niggle point, depending on whether it is possible or not).
Anyhow, that is just a passing thought. (or was it passing wind?)
Do you mean 'custom cells' as mentioned above?
I may look like a mule, but I'm not a complete ass.