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

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

Post by CSAUER »

I would like to announce the first release of my Grid library.
Why you should use this? - Here are my arguments:
- It supports instant cell input, cell locking (no input/no access), multi-selection, column/row headers, instant resizing (columns and rows), column width resizing via mouse
- Very easy to implement, take a look. You can use at most default commands
- Flexible to config. You can read-out and change nearly every parameter, like colors and style flags
- You can use multiple grids in one application
- Have direct access to redraws
- Formated cell output
- columns can have a total/summary (on a column footer)
- table can be sorted (via double-click on column header) ascending as well as descending
- table can be automatically resorted after input in sorting column/adding new row
- table can be locked completely (no access or no input)
- library returns events after entering cell, starting input, finishing input, aborting input, etc.
- Copy/Paste with clipboard
- All user-customizing can be locked
- It should be compatible to MacOSX and Linux as well, because it does not use any WinAPI command (I had no chance to test it)

UPDATED - V 2.2
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
END UPDATED

UPDATED - V 2.3
Major new 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

Here is the link for to the new PB4 compatible sources, incl. example:
http://www.xideas.de/PureBasic/CS-Grid2 ... ources.zip

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

Feel free to test/use this first release and post feedback to this forum.

Future plans:
- Create table according to Database String
- Save cell changes into Database, if table is linked to a database
- Changing columns via mouse drag'n'drop
Last edited by CSAUER on Fri Sep 08, 2006 3:29 pm, edited 9 times in total.
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Very, very nice!

I like it a lot!

Any chance to include a CSGridGadget_SetFont() command ?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

"Error: The following PureLibrary is missing: PBOSL_VB_HELPER"
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Same problem as Trond is experiencing. Also, I have to switch off inline ASM to remove certain other error messages!
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 for your quick response. I took a look into the source code, I found, that I used InStr instead of FindString in two cases. :evil: Sorry, I am an old VB guy. Now this has been changed as well as I removed all UserLibraries before I did the TailBite compilation, so that it should run well on every machine.

Additionally I added the requested 'CSGridGadget_SetFont(Gadget.l,Font.l)' command, as well as the opposite command 'CSGridGadget_GetFont(Gadget.l)'.

Please fee free to test it and give me response, if further problems appears or if you have any other wishes.

New version has been uploaded and replaced the old version.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Very nice, but the scrollbars were kind of fat and didn't quite fit into the window. :lol:
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

It does look good.

Having problems when using the arrow keys to select cells though (with the demo .exe). Select a few cells using a variety of cursor keys and see what happens. I get some odd behaviour with selecting/deselecting.

Regards.
I may look like a mule, but I'm not a complete ass.
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Nice!

Was it programmed in PureBasic?
CSAUER
Enthusiast
Enthusiast
Posts: 188
Joined: Mon Oct 18, 2004 7:23 am
Location: Germany

Post by CSAUER »

@Num3: Yes, it uses Purebasic internal commands only - no WinAPI calls. This was a main target, to have it cross-platform. But I never had the chance to test it on other OS.

I uploaded a new version. This version supports output formatting. User fonts are drawn now. There are several pre-defined outputs as well as user-defined output. For user-defined output, you can use '#' and '0' as place-holder.
For example:
- value: 1234.212
- user-format: '##.##0,00 EUR/pc.'
- result: '1.234,21 EUR/pc.'

@srod: Regarding problem during marking with variety cursor keys, I fixed as well.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

That is impressive bearing in mind there's no explicit API calls. Can I ask, are you drawing directly onto an image etc?

I say impressive, since my own effort is awash with API calls, but then I'm using a subclassed ListIcon. Have nearly finished with the various embedded gadgets allowed in each cell. But I think this work of yours has the potential to be really really flexible.

btw: still having problems with selecting via the cursor keys. Try this with the demo.exe:

select B2, key into A2, then back again. Seems as though the selection rectangle should be 'anchored' at the starting point; i.e. B2. I guess you might have designed it this way!
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. Yes, you are right. I am drawing direct onto an Image.
All the information are stored dynamically inside structured lists. I add all information of all grids to one list. I got one for the grid main data, for col data, for row data and cell data. The col and row data list elements are only set up, if the configuration differs from the default values. So if you change nothing in col headers, there is no waste list element.

All keyboard access is done with "AddKeyboardShortcut()", during edit, I change the shortcuts.

Regarding marking backwards. If you start B2 and you move with SHIFT and LEFT to A2, the Startpos changes from B2 to A2, so that Startpos is always <= Endpos. Does this looks like a bad behavior?

Next thing to implement should be Column ordering.
Another point is, to embedd a Container for Row details. F.ex. if you have a list of all employees, click to row head and expand employee's details. This kind of details will be in a Container and consists of standard gadgets, as well as another CSGridGadget (= sub-grid).

What do you think about this?
CSAUER
Enthusiast
Enthusiast
Posts: 188
Joined: Mon Oct 18, 2004 7:23 am
Location: Germany

Post by CSAUER »

Uploaded a new version yesterday evening.
Supports now:
- columns can have a total/summary (on a column footer)
- table can be sorted (via double-click on column header) ascending as well as descending
- table can be automatically resorted after input in sorting column/adding new row
- table can be locked completely (no access or no input)
- library returns events after entering cell, starting input, finishing input, aborting input, etc.
- All user-customizing can be locked
- Copy/Paste with clipboard
- Speed optimization
- further no API call implemented, should be transferable to all OS
Last edited by CSAUER on Fri Nov 11, 2005 4:20 pm, edited 1 time in total.
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

Pretty slick.

I'll have to play with it a lot more, but I sure like what I see.

Thanks for sharing.

cheers
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

I would like to make a suggestion:

To create a control for entering data... Like this:

Code: Select all

+--------------+-----------------------------------------+
|  Name:       |  *** Input A ***                        |
+--------------+-----------------------------------------+
|  Address:    |   *** Input B ***                       |
+--------------+-----------------------------------------+
Well kinda of a flexgrid, but only with 2 columns (1 locked, 1 for input)
and no headers...
CSAUER
Enthusiast
Enthusiast
Posts: 188
Joined: Mon Oct 18, 2004 7:23 am
Location: Germany

Post by CSAUER »

This is pretty easy. You can do this with the existing version, just download the latest version. I added the below mentioned example as well.

Do it this way:

Code: Select all

hWnd = OpenWindow(0, 0, 0, 640, 240, #WS_OVERLAPPEDWINDOW, "Demo CS-Grid-Gadget") 
If CreateGadgetList(WindowID())
  
  test = CSGridGadget(#PB_Any,10,10,600,200,2,4)         ; Creates a CS-Grid-Gadget with 2 x 2 cells
  CSGridGadget_SetAutoRedraw(test,-1)                    ; Turns off Auto-Redraw for Grid for faster setup  
  CSGridGadget_SetColWidth(test,0,100)                   ; Defines Column-Width for Column 0
  CSGridGadget_SetColWidth(test,1,300)                   ; Defines Column-Width for Column 1
  CSGridGadget_SetCellValue(test,0,0,"Name")             ; Labels cell C:0 R:0
  CSGridGadget_SetCellValue(test,0,1,"Address")          ; Labels cell C:0 R:1
  CSGridGadget_SetCellValue(test,0,2,"ZIP")              ; Labels cell C:0 R:2
  CSGridGadget_SetCellValue(test,0,3,"City")          ; Labels cell C:0 R:3
  For y = 0 To 3
    CSGridGadget_SetCellLockStatus(test,0,y,-1)            ; Locks cells in column 0 for input (not for access)
  Next
  CSGridGadget_SetAutoRedraw(test,1)                     ; Turns on Auto-Redraw for Grid 1 after setup
  CSGridGadget_Redraw(test)                              ; Redraws the Grid
  
  ;AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_C , 1)
  ;AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_V , 2)
  
  Repeat 
      main_EventID = WaitWindowEvent()
      CSevent = CSGridGadget_EventHandling(main_EventID)                    ; Processes all Grid-Gadget events (for all CS-Grid-Gadgets)
      Select CSevent
        Case 32 ; Start input
          ;Debug "START INPUT"
        Case 33 ; End input
          ;Debug "END INPUT"
        Case 34 ; Cancel input
          ;Debug "CANCEL INPUT"
      EndSelect
      If main_EventID = #PB_Event_Menu
        Select EventMenuID()
          Case 1 ; Ctrl + C
            ;CSGridGadget_CopySelectionToClipboard(CSGridGadget_GetActualGrid())
          Case 2 ; Ctrl + V
            ;CSGridGadget_PasteClipboardToSelection(CSGridGadget_GetActualGrid())
        EndSelect
      EndIf
  Until main_EventID = #PB_Event_CloseWindow
  CSGridGadget_FreeGadget(test)                     ; Removes the Grid 1 with all sub-objects and frees memory
  End
EndIf
Post Reply