CS-Grid-Gadget: New Release V 2.3 / PB4

Developed or developing a new product in PureBasic? Tell the world about it.
CSAUER
Enthusiast
Enthusiast
Posts: 188
Joined: Mon Oct 18, 2004 7:23 am
Location: Germany

Post by CSAUER »

Okay, here is my first release of CS-Grid in a PB4 compatible version.
At this release, there are no new features. Just a little bug fixed and adapted version.

I updated the links in the first post as follows:

Here is the link as User-Lib, incl. example:
http://www.xideas.de/purebasic/csgridgadget.zip
Here is the link for to the sources, incl. example:
http://www.xideas.de/purebasic/CS-Grid2-1-SOURCE.zip
Here is the link for to the new PB4 compatible sources, incl. example:
http://www.xideas.de/purebasic/CS-Grid2 ... SOURCE.zip

Enjoy it!
CSAUER
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

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

Post by srod »

Nice work.

However, (I've noticed this before!) double click a disabled cell, and another cell is activated! This is on Win XP home; PB4 final.
I may look like a mule, but I'm not a complete ass.
MLK
User
User
Posts: 57
Joined: Sat Jan 24, 2004 8:46 pm
Location: Germany

Post by MLK »

nice work!

.. but i cant use GetAsyncKeyState_() with any of the keys you are keyboardshortcutting (to window '0' ..^?^) because im not getting any #WM_KEYDOWN/UP.
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

I tried CSGrid, but every time I get the error 'Invalid memory access'.

Code: Select all

#Win = 0
#CSGrid = 1
If OpenWindow(#Win, 0, 0, 800, 400, #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered, "CS-Grid-Gadget") 
  CreateGadgetList(WindowID()) 
  CSGridGadget(#CSGrid,10,10,743,300,5,5)
  CSGridGadget_SetAutoRedraw(#CSGrid,-1)
  CSGridGadget_SetColCaptionVisibility(#CSGrid,1)
  CSGridGadget_SetColCaption(#CSGrid,0,"String")
  CSGridGadget_SetColCaption(#CSGrid,1,"Long")
  CSGridGadget_SetRowCaptionVisibility(#CSGrid,1) 
  CSGridGadget_SetColDataType(#CSGrid,0,0)          
  CSGridGadget_SetCellValue(#CSGrid,0,0,"TESTING")
  CSGridGadget_SetColInputType(#CSGrid,0,32) 
  CSGridGadget_SetColDataType(#CSGrid,1,1) 
  CSGridGadget_SetAutoRedraw(#CSGrid,1)
  
  Repeat 
    main_EventID = WaitWindowEvent() 
    Select main_EventID 
      Case #PB_Event_SizeWindow 
        CSGridGadget_Resize(#CSGrid,10,10,743,300)
      Default 
        CSGridGadget_EventHandling(main_EventID)
    EndSelect 
  Until main_EventID = #PB_Event_CloseWindow 
  CSGridGadget_FreeGadget(#CSGrid)
EndIf
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
CSAUER
Enthusiast
Enthusiast
Posts: 188
Joined: Mon Oct 18, 2004 7:23 am
Location: Germany

Post by CSAUER »

Dear Thorsten,

if you initialize the Grid by using a constant, you get a problem - I never solved so far. If you use #PB_Any instead, your program runs great (if you use PB 3.x).

So you need to replace:

Code: Select all

CSGridGadget(#CSGrid,10,10,743,300,5,5) 
by

Code: Select all

CSGrid = CSGridGadget(#PB_Any,10,10,743,300,5,5) 
Cheers,
CSAUER
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

Sorry, it's not possible to use for every gadget a global variable. My program has over 20.000 rows of code. I'm afraid I must use an other gridgadget.
Thanks for your help.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
nicolaus
Enthusiast
Enthusiast
Posts: 456
Joined: Tue Aug 05, 2003 11:30 pm
Contact:

Post by nicolaus »

Nice Grid but i have found a bug.

Open the example and compile it.

After compile and start it, go in the first row and the 3. colum. In this you see the vaule "139.6548".
Now press ENTER and again ENTER.

Now you see the bug.

regrads,
Nico
CSAUER
Enthusiast
Enthusiast
Posts: 188
Joined: Mon Oct 18, 2004 7:23 am
Location: Germany

Post by CSAUER »

@Nicolaus: I tested it, but I found no bug. In this cell you can find the value 139.6548. If I press enter, I get the same value inside the edit-box. Maybe you have got a but caused by float-conversion (comma instead dot). This will be improved in the next version, I will release in a couple of days.

@Thorsten1867: Maybe you can help me to solve the problem, then you would be able to use it.
My problem is as following:
- The value "Gadget" comes with a value "#PB_Any" or a constant
- I create a container-gadget on this way:

Code: Select all

response = ContainerGadget(Gadget,x,y,width,height,image)
- In case of a constant I do following, to store the constant-value

Code: Select all

if Gadget <> #PB_Any
GadgetID = Gadget
endif
- In every case I want to access the gadget, I get problems, if it has been declared with a constant value. Example:

Code: Select all

FreeGadget(response)
Or

Code: Select all

OpenGadgetList(response)
- A solution could be:

Code: Select all

if GadgetID > -1
OpenGadgetList(GadgetID)
else
OpenGadgetList(response)
endif
But this doesn't bring the expected solution.

This is a point I don't understand. The response-value of ContainerGadget should be similar, even if I use #PB_Any oder a constant.
You can test your example with the open source. There you can trace the problem.

Thanks for you help in advance.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

I do something similar and it works fine:

Code: Select all

gadgetID = ContainerGadget(Gadget,x,y,width,height,image)
If Gadget<> #PB_Any
  gadgetID=Gadget
endif
now gadgetID definitely contains the ID rather than the windows handle.

So you can use

Code: Select all

FreeGadget(gadgetID)
etc.
I may look like a mule, but I'm not a complete ass.
CSAUER
Enthusiast
Enthusiast
Posts: 188
Joined: Mon Oct 18, 2004 7:23 am
Location: Germany

Post by CSAUER »

Thanks srod. This was the piece of hint, I needed.
I did not believe, that GadgetID can be handled similar to the response value. Now it works. You can expect this feature with the upcoming version.

Your new version of your grid is looking amazing. So I have to spend some more work on mine. :wink:

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

Post by srod »

CSAUER wrote:I did not believe, that GadgetID can be handled similar to the response value. Now it works. You can expect this feature with the upcoming version.
Yes, the result of using #PB_Any is the gadget#, whereas the result of using a static id instead is the windows handle, so you just need to check for the absence of #PB_any etc.
CSAUER wrote:Your new version of your grid is looking amazing. So I have to spend some more work on mine. :wink:
:)

It's all good stuff.

Yours has the potential to be far more flexible since you are not relying on a ListIcon etc. but drawing natively to a bitmap etc. Grids within grids are quite feasible with your method.
Apart from introducing more cell types (progress bars for example) I think I've taken my grid as far as I can since it is based upon a ListIcon. A grid within a grid, whilst technically possible, would be a horrendous proposition. :) No thanks!

Anyhow, keep up the good work there.
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 tried your grid. It´s great.

For an applicaton i write I need the feature
of "column drag and drop".

Do you plan to implement this?


Anyway, good work!


Grettings

rw
CSAUER
Enthusiast
Enthusiast
Posts: 188
Joined: Mon Oct 18, 2004 7:23 am
Location: Germany

Post by CSAUER »

Yes, it is on my todo list. But actually I release herewith an new version 2.3 which does not support this feature. Maybe in the next version, but I can not say, when it will come, as I am running out of time and I just wanted to release the bug fixed and extended version a long time ago.

Here are the major features and changes:
- completely compatible with version 2.2
- constant value on declaration now possible (as alternative of #PB_Any)
- cutting text on small width (orientation dependent)
- variable height of rows
- manual orientation of column headers
- manual width of row header
- manual background color for rows and/or columns
- new format: date (allows automatic date formatting)
- new format: pic (allows implementation of pictures as a value of cells - windows only)
- new inputs: combo, trackbar, combo, IP
- now released: details / sub objects
each row can have its own details screen, which can be just a gadget, a container or a sub classed CS-Grid (!)
- optimized: Column size adjustment, display sums, grid rendering, formatting, rounding, scrolling, keyboard entry

Of course, there is additionally an updated help file, but I am not able to provide a userlib, as i don't know how to provide public constants so far. Maybe if you could provide a hint to me, then I would release it.
I did not test it on other platforms, but a Mac OS X report will follow.

Here you can find the link to the sources:
http://www.xideas.de/PureBasic/CS-Grid2 ... ources.zip

Here is a screenshot of a working grid inside a grid:
Image

Have fun.
Comments recommended.

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

Post by srod »

Hi, looks good but I'm still finding the same 'erratic' behaviour that I previously reported, particularly with the selection jumping around.

For example, double click the first check mark to select it. Now double click the second; no problem so far. Now double click the third (which I presume has been disabled) and the fourth checkbox is altered, or sometimes the date gadget in the adjacent cell is activated!

Unless it's just my machine -which is barmy at the best of times! :)
I may look like a mule, but I'm not a complete ass.
Post Reply