EsGRID grid gadget 2.1. Don't post here!

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Fixed. Download version 1.3.5.

Thanks for the report.
I may look like a mule, but I'm not a complete ass.
User avatar
HeX0R
Addict
Addict
Posts: 1189
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Post by HeX0R »

Boah, that was fast!
Many thanks, that solved it.

One more question:
I realized, when selecting all text of a string-field and pressing the Delete-key, nothing happens, i don't even see a single Msg within my callback.
Is this normal?

[Edit]
O.k., this doesn't happen with the above snippet, have to investigate deeper...

[Edit2]
Ha ha ha
forget this last one, i'm stupid like hell :oops:
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

[Edit3]
What the deuce...

:lol:
I may look like a mule, but I'm not a complete ass.
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 639
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Post by captain_skank »

Any way to center an icon within a cell ??

Also, not sure if this is a pb or esgrid peculiarity but using rgb colour values e.g. $ff0000 is not working properly. At the moment it appears bgr so red is $0000ff.

An excelent grid though. :)
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Icons are automatically centered. Just set the width and height that you would like the icon displayed in the cellcallback and that should be it.
I may look like a mule, but I'm not a complete ass.
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 639
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Post by captain_skank »

my bad - had some text in the cell as well. :oops:
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

I don't see how that would effect matters. If you set the cell's type to #egrid_Icon then any cell text is ignored. You can store text in the cell and retrieve it again, but it will not effect the rendering of the icon.
I may look like a mule, but I'm not a complete ass.
ebs
Enthusiast
Enthusiast
Posts: 557
Joined: Fri Apr 25, 2003 11:08 pm

Re: EsGRID grid gadget 1.3.4. (Compiles with PB 32 and PB 64)

Post by ebs »

srod,

Is it possible to restrict cell selection using the mouse to only one row?
I have successfully used a CellCallback function to trap the initial cell selected by a mouseclick,
but I haven't been able to figure out how to catch the cells selected when the user drags the mouse.

Is there a way to get the row/column for each selected cell as the user selects a range of cells?

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

Re: EsGRID grid gadget 1.3.4. (Compiles with PB 32 and PB 64)

Post by srod »

egrid_GetCellSelection() will allow you to determine the range of cells selected (although you may have to take the column order into account if you have allowed the user to reorder columns etc.)

It is currently not possible to restrict the user's actions whilst engaged in multiple cell selection etc. although you can prevent all such selections etc. I'll have a quick look and see if I can easily implement this. If it's too much work then I am afraid that it will not be implemented any time soon because I am just too busy. :)
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: EsGRID grid gadget 1.3.4. (Compiles with PB 32 and PB 64)

Post by srod »

@ebs : right, a quick tinker first revealed a huge problem with EsGRID and PB 4.4 which has taken me 3 hours to get to the bottom of and fix! :) Second, yes I can implement what you are asking and we basically have two choices.

The easiest option is that I add a creation flag to EsGRID; something like #egrid_SingleRowCellSelection (and one for columns) which will then prevent the user selecting cells beyond those in the initial row etc. This option requires about 6 lines of code! :)

The second option is a new CellCallback message which fires whenever the multiple-cell selection changes through user action. This message would inform you about the range of cells the user is attempting to select and give you the opportunity to refuse/alter the selection (within reason). This would involve quite a bit of work (not a massive amount though).

The reason I ask your opinion here is because I do not like the second option for one reason alone; namely that it could slow things down massively. Imagine the user clicking a cell and sweeping the mouse off of the screen. This would result in a barrage of messages being sent to your callback whilst EsGRID sought your permission to highlight the cells as the selection rapidly changed. This is on top of all the other messages being sent whilst the grid is continually repainted because of all the scrolling / selection etc. There would be a right old backlog of messages!

How do you feel about the first option? Would it be enough for your purposes?
I may look like a mule, but I'm not a complete ass.
ebs
Enthusiast
Enthusiast
Posts: 557
Joined: Fri Apr 25, 2003 11:08 pm

Re: EsGRID grid gadget 1.3.4. (Compiles with PB 32 and PB 64)

Post by ebs »

srod,

Thanks for your fast reply!

Yes, the creation flags approach would probably be sufficient for what I need,
and I agree about the "message overload" that could result with the callback method.

But, as long as you're in a generous mood :wink:
Would it be possible to make the "SingleRowCellSelection" and "SingleColumnCellSelection"
flags able to be changed at run-time?

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

Re: EsGRID grid gadget 1.3.4. (Compiles with PB 32 and PB 64)

Post by srod »

Okay, I'll finish it tomorrow. It turns out to be a little more complex than I thought (more than 6 lines of work! :) ) but it shouldn't take long.

What I will do then is not use a creation flag, but an option which we set with egrid_SetOption(). Actually this makes more sense in this case anyhow. The default will be for full cell selection, but then you will be able to select between full cell selection, selection within a single row, selection within a single column or no selection at all. This can of course be changed at run-time etc.

That should do it.
I may look like a mule, but I'm not a complete ass.
ebs
Enthusiast
Enthusiast
Posts: 557
Joined: Fri Apr 25, 2003 11:08 pm

Re: EsGRID grid gadget 1.3.4. (Compiles with PB 32 and PB 64)

Post by ebs »

srod,

Thank you!
Please let me know when the new version is available.

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

Re: EsGRID grid gadget 1.3.4. (Compiles with PB 32 and PB 64)

Post by srod »

25th September 2009 EsGRID 1.4.0 for PB 4.3 / 4.4.

Hi,

Version 1.4.0 of EsGRID has the following changelog :
  • Fixed a major incompatibility between the EsGRID source, Vista and Purebasic 4.4.
  • The developer can now specify that multi-cell selections are no longer highlighted with a background color (just with the border). This is achieved through the egrid_SetOption(..., #egrid_SelectedCellsColour, -1) function by specifying the color value to equal -1.
  • Have removed the #egrid_ProhibitCellSelection extended style creation flag. Instead, use the egrid_SetOption(..., #egrid_SetCellSelectionRange, value) function with the value parameter set to one of the following :

    #egrid_CanSelectAllCells (Default)
    #egrid_CanSelectSingleColumnOnly
    #egrid_CanSelectSingleRowOnly
    #egrid_ProhibitCellSelection

    For example, egrid_SetOption(#myEsGRID, #egrid_SetCellSelectionRange, #egrid_CanSelectSingleRowOnly) means that when the user selects a range of cells (through click and drag for example) then he/she can only select cells within the initially selected row etc.
http://www.nxsoftware.com
I may look like a mule, but I'm not a complete ass.
zikitrake
Addict
Addict
Posts: 868
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: EsGRID grid gadget 1.3.4. (Compiles with PB 32 and PB 64)

Post by zikitrake »

Dear Srod:
Since I'm having problems with EsGRID 1.40 and/or PB 4.40b3, I put a debug line in my 'problematic' procedure

Code: Select all

Procedure.i egrid_listiconcallback(hwnd, uMsg, wParam, lParam) 
And I get some errors: Invalid Memory access, cells mixed with debug text...
See image from EsGRID demo7.pb:
Image

Sorry for my limited english! :roll:
PB 6.21 beta, PureVision User
Post Reply