Grid Controls package (Ver 1.5)

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...

Grid Controls package (Ver 1.5)

Post by srod »

1st Feb 2014.

Following the recent major update (ver 1.4), we follow with a second which, amongst other things, improves on the newly added drag/drop and the long standing copy/paste routines.

This updates mostly effects the EsGRID control (now version 2.4), but with some minor alterations to ExGRID (now version 1.5) to keep in line with those changes.

Please see the EsGRID 'history.txt' file in particular for a list of changes etc. This update can break code designed for the recently updated 1.4 version, but not serious ones.

A brief summary of what has changed :
  • Have reworked the delete, copy/paste, drag/drop routines massively which, if dealing with a large range of cells, were very slow and inefficient. The routines now use very little of PB's string library and use direct API for clipboard access and OLE drops.
  • Drags with a 'move' action will result (if successful) in the original cells being deleted regardless of whether the drop occurs on the source control or otherwise. This was not the case in the previous version. Of course this does not happen if the drop was cancelled for any reason (e.g. through a cellcallback function).
  • #egrid_ClipboardOrDragDrop (and ExGRID_CLIPBOARDORDRAGDROP) cellcallback messages have been altered slightly to give more info on drops with the addition of a couple of extra fields in the cellinfo structures.
  • Potential drop targets (assuming they are one of our grids) will now automatically scroll even if the drag source is in another process.
  • When cells are pasted, the target range of cells is now automatically selected (and highlighted) on completion of the operation. This matches what happens when cells are dropped onto a grid.
  • Added the facility for preventing all 'cell updated' notifications from being sent. This can speed up the paste, delete and drop actions significantly if dealing with large grids.
There is one thing to definitely be aware of, namely that any program compiled in Unicode mode will only accept dropped text which is in Unicode format. A similar statement holds for Ascii. This should not be too big a problem since many apps allowing text drags, offer up the text in both formats. E.g. no problem dragging from Excel etc. If this proves a problem then we can change this.

There is another limitation regarding the number of characters which will be copied from individual cells. See the manuals for that.

There are a couple of other changes as well.

Those who purchased the full Grid Controls Package can download from the usual place.

Those who purchased just the EsGRID control (or the original egrid control) then please contact us and the latest version of EsGRID will be e-mailed. This applies no matter how long ago the original purchase as per the terms of lifetime updates.

Regards.

===============

27th Jan 2014.

Major update to our grid controls package. More specifically, upgrades to EsGRID (version 2.3) and ExGRID (version 1.4). The tBOX property box control has not been upgraded.

Purebasic 5.21LTS onwards.

We have added a much requested feature, namely drag / drop... and fixed some bugs! :smile:

We can now drag the text from the currently selected range of cells and drop onto any control/window enabled for drops (e.g. those enabled with the Purebasic EnableTextDrop() function or an Excel sheet etc.) We can also drop the text dragged from any suitable control (not just our grids) onto a suitably enabled grid. For example, select a range of cells from Excel and drag them onto one of our grids.

This has required quite an upheaval of the EsGRID code base in particular, so please regard the 1.4 version of the Grid Controls Package as a 'test' version. There will be some bugs which remain for sure.

Please see the relevant 'history.txt' files for a good summary of the changes made to the various APIs etc. No old code should break as a result of these changes (bugs withstanding of course!) The various user manuals have been updated. In particular, each manual has a page given over to drag / drop which are well worth reading.

A brief summary of our drag / drop :
  • Client apps have full control over drag / drop operations via cellcallback functions (as usual)
  • If dropping onto any window/control other than the original EsGRID, then the drop defaults to a copy. The dragged cells in the original grid are left untouched. We did this to mimick the way Excel handles such drags etc.
  • If dragging between grids in the same process, then the drop target will automatically scroll as the cursor drags over it. This can be extended to include non-grid drag sources (in the same process as the drop though).
  • If dragging between grids in the same process, then the drop range will conform exactly to the drag range. For example, if a single row of 10 cells are dragged by clicking into the 3rd cell from the left, then when dropped onto a grid from the same process, the cells will be dropped so that the cell beneath the drop cursor is the 3rd cell from the left.
  • It goes without saying that you can drag and drop to the same grid!
There is a very basic demo for EsGRID showing drag / drop in action. It would be a piece of cake to translate to ExGRID. All manuals updated and so on.

Those who purchased the full Grid Controls Package can download from the usual place.

Those who purchased just the EsGRID control (or the original egrid control) then please contact us and the latest version of EsGRID will be e-mailed. This applies no matter how long ago the original purchase as per the terms of lifetime updates.

Regards.

**EDIT : oh yes, modified ExGRID so that it can now be used in a PB splitter gadget. :)

=====

Hi,

am fed up switching between different threads for EsGRID and ExGRID etc. when all of the grid controls come in a single package anyhow and so have started this one to replace the individual forum threads. :)

I will post a note in the threads concerned.

Anyhow, the latest update is as follows...
Last edited by srod on Sat Feb 01, 2014 8:55 pm, edited 4 times in total.
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...

Re: Grid Controls package (Ver 1.3)

Post by srod »

2nd July 2012

EsGRID 2.2.

Hi,

Have altered the cell rendering engine to reduce flicker (especially when selecting multiple cells under mouse control) and to speed up rendering.

It makes a lot of difference on my slow laptop!

This will also benefit ExGRID and tBOX since both are of course built atop of EsGRID.

The current version of the grid controls package is 1.3.

Regards.

=========================


1st July 2012

EsGRID 2.1 / ExGRID 1.3.

Hi,

Have added a new cell type to both EsGRID and ExGRID (#egrid_CustomTextDialog / #ExGRID_CUSTOMTEXTDIALOG).

These cells can be used to display static text alongside a 'selector button' which the user can click (or double click the entire cell) in order to fire an appropriate notification to a CellCallback function. That is, the text and the button reside within the same cell (much like the various 'chooser' type cells which our tBOX property box control offer).

The idea is that when the user clicks an appropriate 'selector button', the client application will then throw up some dialog or other appropriate to the cell in question. When the dialog has run it's course then the client app would make any appropriate changes to the underlying grid cell.

Have added a new demo to the EsGRID control to show how to make use of these new cells. The demo offers one way of allowing users to edit dates etc.

Note that any modifications made to these new cells are not reported in the #egrid_CellUpdated / #ExGRID_CELLUPDATED messages. This is because such cells are not edited directly by the user and the client app, through having thrown up a dialog in the first place, will already be aware of the changes made!

Regards.

Stephen.
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...

Re: Grid Controls package (Ver 1.3)

Post by srod »

NOTE to EsGRID users (those who own the entire grid controls package can ignore this).

Just a note/reminder to those who have purchased EsGRID at any time in the past (or indeed the even earlier egrid) and have not updated to the complete grid package.

You might be wondering why you can no longer access the download section?

Worry not, your lifetime license is still completely valid. So few people have not upgraded that it is simply not viable for me to maintain 2 separate download sections of my website. Consequently, there is only one download section now; namely for those who have purchased the entire grid controls package.

There is no need to upgrade though (unless you need the enhanced features of ExGRID which could just not be added to EsGRID; and I tried, believe me! :) ) because EsGRID is still being maintained and updated (as you can see by the recent posts).

Any licensed owner of EsGRID who has no access to the download area and who is in need of the latest version of EsGRID simply needs to contact me and I will be more than happy to e-mail the latest version etc. No worries, no fuss!

I put up this reminder because I still have people making purchases of an upgrade to the full package when in fact all they require is the latest version of EsGRID!

Saves having to issue refunds! :)
I may look like a mule, but I'm not a complete ass.
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Re: Grid Controls package (Ver 1.3)

Post by Olby »

May I suggest a flag called #tBOX_AutoStretchLabelColumn. It would be extremely useful if tBOX did this automatically. Thanks!
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Grid Controls package (Ver 1.3)

Post by srod »

Sorry, I don't follow; why would we want to stretch the label column?

tBOX will automatically stretch the value column if requested, but, to my mind, it doesn't make sense to stretch the label column! You certainly couldn't do both!
I may look like a mule, but I'm not a complete ass.
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Re: Grid Controls package (Ver 1.3)

Post by Olby »

Sorry, I just reread my post and realised that I made it totally unclear. Sorry for that. :oops: What I meant was a native command or a flag that will automatically resize the label column when a label that does not fit it is added. Now it will just add triple dots and it wont be fully visible unless I manually send resize message to second column of the underlying list icon. Maybe it's already there and I just missed it somehow. Thanks.
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Grid Controls package (Ver 1.3)

Post by srod »

Done! (Even if it is a strange thing you are requesting here! :) )

And it was hard work; harder than you might imagine because of the way EsGRID operates. :)

I have uploaded a test version of tBOX which you can download through the normal channels.

The flag you need to use is : #tBOX_AutoSizeLabelColumnToFitText

I have set it up so that, with this flag, the label column will automatically adjust to fit the text on display (excluding hidden rows which have been collapsed) whenever one of the following occurs :
  • A label is altered by the user (requires #tBOX_EditableLabels style)
  • A label is altered through the use of the \SetItemText() method
  • A group is expanded or collapsed either through user action or through code.
You will notice that I do not resize the column after rows are added or removed. This is because things slow down too much (imagine adding 100 rows etc.) Instead, when you have finished adding rows (or removing them) use the newly added method : \AutoSizeLabelColumnToFitText(). You can use this method even if #tBOX_AutoSizeLabelColumnToFitText has not been set.

Please play around and let me know what you think. I can change the behaviour of this if you wish it.

I will say that if there are too many problems/bugs with it then I shall simply remove this facility because, well, it is very fiddly to implement correctly without breaking the propertybox itself. There is a lot going on behind the scenes here to get this working correctly; a few wild hacks included!

Please test thoroughly.
I may look like a mule, but I'm not a complete ass.
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Re: Grid Controls package (Ver 1.3)

Post by Olby »

Am terribly sorry if my request seemed tad obscure. ;) I hope future users will find it useful as well. Meanwhile I did a quick test drive and here's an issue I've found. AutoSizeLabelColumnToFitText() to resize once is all I did- don't have time now to test if it's a new issue or it was already there.. Anyhow... Thanks for the prompt update.

Image
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Grid Controls package (Ver 1.3)

Post by srod »

Sorry I don't see a problem with that. The new functionality resizes the column; not the propertybox. Or am I missing something?

With the propertybox you are displaying, the value column is auto-resizing with the propertybox. When the label column resizes beyond the bounds of the grid then obviously the auto-sizing value column will be given a width of zero. That is all you are seeing and it is perfectly normal (and inevitable) even without resizing the label column. Turn off the auto-sizing of the value column if you don't like that behaviour.
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...

Re: Grid Controls package (Ver 1.3)

Post by srod »

@Olby : I have uploaded a new test version. In this one, the width you give the value column when you create the propertybox will now act as the minimum width when you have the #tBOX_AutoStretchValueColumn style set.

This means that whilst the value column will auto-resize when you resize the control, it will not resize below that width specified. This will hopefully set your mind at rest in regards to the behaviour you reported above. Set this width to zero for the default behaviour as displayed in your video.

Obviously if you have not set the #tBOX_AutoStretchValueColumn style then you need to set this width to a suitable value etc. (Not zero!)
I may look like a mule, but I'm not a complete ass.
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Re: Grid Controls package (Ver 1.3)

Post by Olby »

Stephen you're a star! I hope that everyone agrees that by adding this functionality you improve the overall usability of the component. Most common real life scenario would be user interface translations. It's so useful if it automatically adapts to the contents. Thanks for doing this. I just did some testing and it seems to works just fine.

Btw. Excuse me for my previous post as I was drowsy and didn't realise that AutoStretchValueColumn was causing that. :D
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Grid Controls package (Ver 1.3)

Post by srod »

No worries. I understand that can be a little off-putting at first. :)
I may look like a mule, but I'm not a complete ass.
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Re: Grid Controls package (Ver 1.3)

Post by Olby »

What is the correct way to get color item (\AddColorItem) color after user interaction via the dialog. Is it the #tBOX_DefaultColor attribute?

Also I wish there would be a way to change hex color codes to RGB ones like in this picture:

Image

Mainly because they look more "down to earth" to a regular Joe.

Thanks!
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Grid Controls package (Ver 1.3)

Post by srod »

Yes, the #tBOX_DefaultColor item attribute is the way to go.

As for RGB... not a bad idea. I'll perhaps adjust things so that you can set the text yourself (so you can use RGB if you wish). In the absence of any text, tBOX will default to the hex values as shown right now. Need to give it a little thought though.

Not sure when I'll be able to make this change though because I am busy for the next few days.
I may look like a mule, but I'm not a complete ass.
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Re: Grid Controls package (Ver 1.3)

Post by Olby »

srod wrote:Not sure when I'll be able to make this change though because I am busy for the next few days.
Thats all right, it's not a show stopper anyway. Just something I always wished for (since original nxPropertyBox). Thanks!
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
Post Reply