My MyTable/MyGrid

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
STARGÅTE
Addict
Addict
Posts: 2067
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: My MyTable/MyGrid

Post by STARGÅTE »

Cyllceaux wrote: Wed May 26, 2021 11:11 am 4 - 2 + 3 = 5
Of course, it was a mistake from me. Thanks.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 636
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: My MyTable/MyGrid

Post by captain_skank »

Hi,

Is there a way of selecting a cell but being able to retreive the text of all cells in the row ? at the moment you have to click on the id column to select a row and retreive the resulting info.

Also can the highlighting of a row be enabled when clicking on a cell.

I realise your concentrating on making a spreadsheet style grid, but this so much better than the listicongadget, variable row height for me is a real winner.

cheers
Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: My MyTable/MyGrid

Post by Cyllceaux »

hey cap :)

something like?

Code: Select all

*row=*cell\GetRow()
NewList cells.MyTableCells()
*row\GetCells(list cells())
I like the Idea... I will add this.

Highlighting row/col for selected cell is on of my TODOs :)
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 636
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: My MyTable/MyGrid

Post by captain_skank »

Nice

To be fair, as long as there was a way to return the row no. from a cell then it's trivial to get individal cell or all the rows data with the existing MyTableGetCellText().

Maybe something like MyTableGetCellRow(), MyTableGetCellColumn()

Of course if you can return the no of columns this also makes looping through a rows columns easier :wink:

Anyhoo thanks for considering it.
Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: My MyTable/MyGrid

Post by Cyllceaux »

Oh.. The Row.ID is not the rownum...

The ID is a custom ID for the row. If you don't put an ID to addRow, it use an internal counter which always increase.
Maybe something like MyTableGetCellRow(), MyTableGetCellColumn()
I will take a look to this. Sounds useful to me.
eck49
Enthusiast
Enthusiast
Posts: 153
Joined: Sat Nov 14, 2020 10:08 pm
Location: England

Re: My MyTable/MyGrid

Post by eck49 »

** Import from LibreOffice Calc?

** Multiple worksheets?
Perhaps by allowing one instance of the gadget to reference cells in a simple way like excel and calc do =Othergrid.f7
But maybe this is already catered for (I've only just come across this, which looks like brilliant work - thanks)

** something to think about - what about a 3D spreadcube, only one plane showing at a time but calculations could be transplanar
like =SUM(RCD(18,14,22):RCD(19,12,37)) where RCD means Row, Column, Depth. This would sum 2x3x16 ie 80 cells.
Ubuntu 22.04 64-bit
Purebasic 6.00 (as of 5 Sep 2022)
(native tongue: English)
Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: My MyTable/MyGrid

Post by Cyllceaux »

Hi eck...

I don't want to write a complete Excel/Calc... maybe some day :) At the moment it is more a PoC which I use in a lot of projects. The formulas and grids are a small version... at the moment.

Multiple Worksheets are on my todo-list (one of the reasons the tables can have names)

UH.... UH.... 3Dimensional spreadcubes... that sounds sexy... :!: I will do this :!: !!!!
eck49
Enthusiast
Enthusiast
Posts: 153
Joined: Sat Nov 14, 2020 10:08 pm
Location: England

Re: My MyTable/MyGrid

Post by eck49 »

@ Cyliceaux

'Complete' Excel/Calc would be very ambitious except for the pleasure of achievement.

One of the hidden resources of E/C is the basic-like macro language, which enables the skilful user to do things not otherwise provided for - at the cost of learning a new language. These are programs within a spreadsheet. With your grid gadget in PB, we have a spreadsheet within a program.

What's more, with the grid, because of the ability to trigger events from within the grid, we can arm ourselves with tools like E/C macros without the cost of coping with the hassle of coping with a new language. Win/win!

** Import from Calc may not be hard - I know it is possible to extract the principal worksheet in a Calc file as a csv without first opening it in Calc, with a Linux Terminal command - soffice, with the appropriate parameters. Not sure where I came across that nugget but it was some time ago.

** Meanwhile, thanks again for working on this. For me, it is the one big gap in the native PureBasic toolkit.
Ubuntu 22.04 64-bit
Purebasic 6.00 (as of 5 Sep 2022)
(native tongue: English)
Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: My MyTable/MyGrid

Post by Cyllceaux »

Hello buddys...
Sooo... now some new features.
  • Matrix (Multidimensional Cells):
    There are always 2 Dimensions (row, columns)
    3 Dimension: {9;1} A cell has a list of values
    4 Dimensions: {{9;1};1;5} The first Dimension of a Cell has a List of values
    * Dimensions: {{9;1;{9;1;5}};1;{9;1;5}} The First Cell has a List of cell, the 3 Entry of the List has a list of cells, too. The 3 value of the root-cell has 3 Values
    The Formula for the Dimension Call: =MATRIXVALUE(0;0;0;2;1)
    the first 2 Zeros are row and column.
  • Application (across tables formulas)
    Table1!A1
    Table1!A1:C2
  • Some Fixes
@eck: you can add your own DLLs, if you want and do your own calculations.
You can listen to Cell-Change events.
you can Add your own formulamethods, too :)
I know it's not the same like a macro, but I will do what I can :)

The Load/Save Feature is still to-do. When I add this, I add import/export for calc and excel.

@cap:
all your wishes are in, except the highlighting. (still on the todo)
eck49
Enthusiast
Enthusiast
Posts: 153
Joined: Sat Nov 14, 2020 10:08 pm
Location: England

Re: My MyTable/MyGrid

Post by eck49 »

Awesome.... not a word I use very often.

So with the multidimensional thing..
I'm a bit puzzled by the notation.
If I have a 3D matrix:

Code: Select all

front plane
2 4 6 8
5 7 9 12
11 42 7 3

middle plane
103 172 119 102
142 143 144 145
151 157 159 161

back plane
222 224 226 228
242 244 246 276
203 205 207 209
please can you explain how this looks in the notation?
I daren't actually download the code to experiment myself directly just yet, or I'll loose track of the main project I'm working on.
I have an eye on this for the next one, which will use a lot of grids.
Ubuntu 22.04 64-bit
Purebasic 6.00 (as of 5 Sep 2022)
(native tongue: English)
Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: My MyTable/MyGrid

Post by Cyllceaux »

Hi eck,

For your Example the cell A1 will look like: {2;103;222}

But the Matrix-Range is not implemented at the moment. But is on the TODO. (yes, long todo list)
Formulas in Matrix is not implemented, too... there are some strange brain cells winding thing to do in this construct.
The last time I used multidimensional mathematics were when I visited the queen of England in 1800 in my blue phone box :D


But, don't be afraid... I will implement it soon.

@captain: I'm on your wish, too... you run under the feature called "border-color" 8)
eck49
Enthusiast
Enthusiast
Posts: 153
Joined: Sat Nov 14, 2020 10:08 pm
Location: England

Re: My MyTable/MyGrid

Post by eck49 »

@Cyliceaux

Thanks, that makes it clear to me.
Re the 'todo' list - better to do it carefully and well than do it in haste!

1800
I wonder if your decision to visit Queen Charlotte was to avoid one of King George III's bouts of mental illness? Hard times.
Ubuntu 22.04 64-bit
Purebasic 6.00 (as of 5 Sep 2022)
(native tongue: English)
Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: My MyTable/MyGrid

Post by Cyllceaux »

New Version:
https://github.com/Cyllceaux/MyTable
  • Borders and Bordercolors
  • Row/Col show selected Cells (for captain)
  • Copy (only Rows and Cells. Rows splitted by ;) + Paste (only in one Cell)
  • some Performance Tweaks
Image
Image


@eck: Your wishes are next :)
Btw... King George was not my fault. He want to know who rules Germany in my time. I showed him a picture and BAM... blind and confused.
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 636
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: My MyTable/MyGrid

Post by captain_skank »

Hi,

Sorry, had a vacation ( in the garden :) ) and haven't touched a PC in a week.

I've been looking at your changes and cannot figure out how to return the row data when clicking on a cell, couldn't give me a pointer ( no pun intended ) could you ?

The cell formatting is great BTW.

cheers
Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: My MyTable/MyGrid

Post by Cyllceaux »

The easiest way is to register an event:

The Row:

Code: Select all

Procedure RowSelected(*row.MyTableRow)

EndProcedure

*table\SetEventRowSelected(@RowSelected())
Or the Cell:

Code: Select all

Procedure CellSelected(*cell.MyTableCell)
   Protected *row.MyTableRow=*cell\GetRow()

EndProcedure

*table\SetEventCellSelected(@CellSelected())

btw.
I'm working on a second version. There is to much "dirt" in the old Version :oops:
Post Reply