egrid 4 grid gadget - (static PB library version.)

Developed or developing a new product in PureBasic? Tell the world about it.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

(I'm having problems with a major redrawing issue at the moment so the next update will be a little delayed. :? )

Try #egrid_CellUpdated. Whenever a checkbox is clicked, it fires this event to inform the program that the cell has changed.

Not sure about altering the checkbox by using the spacebar though.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

BETA 4 released. 19th October 2006.

This is quite a big one and what will be the last beta before a full release.

Added a Unicode threadsafe version of the lib and everything is packaged within a nice installer (thanks to Thorsten1867's excellent EasySetup :) ).

Numerous bug fixes, a new cell type (command buttons), numerous requests addressed and mostly implemented. Vastly improved integration with PURELVSort (thanks Gnozal). Note, egrid now automatically removes the selection box when a sort is underway so you no longer need to do this yourself.

A lot of changes on the headers have been forced on me by various bugs in the Windows common controls library. The biggest is the fact that I've had to take over the column resize completely and code this from scratch. The result is a far faster and smoother resize as I've essentially removed the full column resize as you drag (removed the #HDS_FULLDRAG - but herein lie the Windows bugs).

Did some testing on Win 98 and got it working. Subsequent alterations may mean the code doesn't run properly on win 98. I'll test this again when I get the time.

An extra demo program shows how to reinstate the selection box after a column resize or a column drag etc.

I've been testing the new stuff for quite some time, but haven't had so much time to test whether I've broken any of the old code!

Please see the history page for a list of changes.


Have also added a free-and-cheerful message board to the egrid site. Why not indeed! 8)


Right, I'm off to get some sleep! :D


http://www.purecoder.net/egrid.htm
I may look like a mule, but I'm not a complete ass.
rw
User
User
Posts: 27
Joined: Mon Sep 04, 2006 9:55 pm

Post by rw »

Hi srod!

Thanks for the new version. It´s almost perfect. The integration with
purelvsort is very useful. The new #egrid_RegainFocus event works
perfect.

My remarks on the new version:

The header rendering (No custom header) has changed. With the default
PB-font the header must now have a minmum height of 26 to render
correctly. Although the the header icon of purelvsort vanished. Please
take a look.

With custom header the minimum size is although 26. It´s only optical, but
could you take a look if the minimum size could be reduced?

I think you need a egrid_setHeaderWidth command. For now i use the purelvsort command, but i think we need a native egrid-command.


Really very very good work!

By

rw
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

rw wrote:Hi srod!

Thanks for the new version. It´s almost perfect. The integration with
purelvsort is very useful. The new #egrid_RegainFocus event works
perfect.
Thanks. It was a lot of work.
rw wrote:My remarks on the new version:

The header rendering (No custom header) has changed. With the default
PB-font the header must now have a minmum height of 26 to render
correctly. Although the the header icon of purelvsort vanished. Please
take a look.
Have fixed the column height problem. Well done for spotting that. That one escaped me.

The thing is that in order for the new command button type cells to 'blend' in with the header cells, I was forced to attack the header and alter the 'standard' header to a custom one made to look as much like a standard one as I could manage. In doing this I screwed around with the margins etc. Forgot about that!
It also meant me sacrificing the sort icon - something you'll have to live without I'm afraid. I will eventually allow the use of icons in header cells, so you can place some icons of your own for the sorting etc.
rw wrote:I think you need a egrid_setHeaderWidth command. For now i use the purelvsort command, but i think we need a native egrid-command.
I was thinking about that, but there's enough commands already. Remember that the #egrid_RegainFocus will not fire if you alter the column width in code. I can alter this I guess if you really need it.
rw wrote:Really very very good work!
:)

Next update will be a few days away as I'm off for a piss up .. uhm I mean cultural visit... :wink:
I may look like a mule, but I'm not a complete ass.
rw
User
User
Posts: 27
Joined: Mon Sep 04, 2006 9:55 pm

Post by rw »

Hi!

I write a code to fill the egrid on cursor movement. Problem here is if the
user takes the vertical scrollbar to move the egrid. Do you know if it´s
possible to get the scrollbar position and recognize.

Perhaps a winapi way?

Thanks

rw
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Not sure what you're after here? Why not just populate the whole grid?

Are your working towards a virtual grid or something?
I may look like a mule, but I'm not a complete ass.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

thx for the new version :D

can you change the packformat from the installer, from jcalg1 to zip
i have a other folderstructure for the examples, so i will unpack this by
myself.

regards
Thomas
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Will do.

How do you unpack it yourself? If you don't mind me asking.
I may look like a mule, but I'm not a complete ass.
rw
User
User
Posts: 27
Joined: Mon Sep 04, 2006 9:55 pm

Post by rw »

Hi!

Don´t know what a virtual grid is :-).

It´s the performance. Try to populate the grid with > 10000 rows.


rw
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

ts-soft wrote:can you change the packformat from the installer, from jcalg1 to zip
It's possible to create both, a setup program and a ZIP-file, with EasySetup.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Sorry rw, you'll need to be a little more specific.

If you've got more than 10000 rows, but most of them are empty then... why have 10000 rows in the first place? :)
I may look like a mule, but I'm not a complete ass.
rw
User
User
Posts: 27
Joined: Mon Sep 04, 2006 9:55 pm

Post by rw »

Hi!

I fill the grid with the first 100 (from 10000) dataitems. Then, if the user
scrolls down (cursordown, pagedown) i load the next 100 dataitems and apend them in egrid.

If the vertical scrollbar is used i must append xxx dataitems. If i could catch the scrollbar (scrollbar position) i could do that.

Grettings

rw
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Right, it's win api I'm afraid.

I haven't time to test this, but you need to subclass the egrid and examine the #WM_VSCROLL message.

Psuedo code for your #WM_VSCROLL handler:

i) call the 'previous' handler with CallWindowProc_(). This is essential as I have completely customised the scrolling of an egrid.

ii) Use a combination of the #LVM_GETTOPINDEX and #LVM_GETCOUNTPERPAGE to figure out the top most visibleitem and the number of visible rows etc.

Afraid I haven't time to code this and I'm not 100% sure this will do what you're after without alteration.

This isn't really something I can add to the library except to say that what you're really after is a 'virtual' egrid and this will have to wait a while I'm afraid.

:)
I may look like a mule, but I'm not a complete ass.
rw
User
User
Posts: 27
Joined: Mon Sep 04, 2006 9:55 pm

Post by rw »

No problem!

I don´t think, that this must belong to the egrid lib.

I will try it with the winapi.

What are virtaul grids?

rw
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

rw wrote:What are virtaul grids?
Right, I'm away for a few days now so won't be able to help out for a while.

To be honest rw, I would advise that you halt what you're doing because it just doesn't make sense to set up an egrid with 10000 rows but only ever fill 100 rows with data.

The egrid library will not be any faster for doing things this way as it only paints the visible cells anyhow (mostly!). That is 10000 rows with only 100 containing text will not be any faster than 10000 rows with every row containing text. Granted, I accept that the speed problems will be in loading the original data etc. but I think you should look elsewhere to get around this.

Either set up the egrid with 100 rows and load them dynamically, or... wait for the virtual egrid!

A virtual egrid would NOT store any of the cell contents (and neither would Windows). Instead, every time a cell needed to be painted, egrid would call your Cellcallback function and ask for the text etc. This would be the ideal way of addressing your problems.

Unfortunately, implementing this into egrid is not as straight forward as it sounds because of certain 'dirty tricks' which I've used to cut a few corners!

A virtual egrid is now next on the 'todo' list. :)
I may look like a mule, but I'm not a complete ass.
Post Reply