Page 3 of 7

Re: My MyTable

Posted: Thu May 06, 2021 7:37 pm
by davido
@Cyllceaux,
I assume that your code is intended for PCs.
Are there any reasons why it will not run on Mac OSX?

Re: My MyTable

Posted: Thu May 06, 2021 8:06 pm
by Cyllceaux
I don't use explicit Windows or Linux calls.

Can you show me, what happend on Mac-OS? Maybe a Bug in PB.

Re: My MyTable

Posted: Sat May 08, 2021 12:35 pm
by Cyllceaux
Now with tooltip and the first Version of the Grid

https://github.com/Cyllceaux/MyTable

Image
Image

Re: My MyTable

Posted: Tue May 11, 2021 5:47 pm
by Cyllceaux
New Version: https://github.com/Cyllceaux/MyTable
  • Multiselect with Shift or marking with the Mouse (dirty but working)
  • improved Grid Performance
  • Import and Export for XML, JSON and CSV

Re: My MyTable

Posted: Fri May 21, 2021 10:13 am
by captain_skank
Hi,

First up - excellent work, looks like a very usefull addition to PB.

If i may make a suggestion, please seperate out your demo code into individaul examples as trying to understand how everything works is quite difficult imho.

For example, for my own usage i'm interested in the last grid in your example with varying row height, but I can't for the life of me figure out how to disentangle it from all the other grids to get a single working example.

As i said earlier though a very usefull piece of work and thanks for sharing.

Cheers

Re: My MyTable

Posted: Fri May 21, 2021 2:59 pm
by Cyllceaux
Heyho captain :)

Yes... It was my plan to separate into different tests... I use it in one window to find problems with events and performance, if you use a lot of controls in 1 window.

My actual github version has the first draft of the formula. I'm sure you don't need it.. but I want to finish this first, before I move to other tasks.
but for your example:

Code: Select all


Global canvasGrid=CanvasGadget(#PB_Any,0,0,0,0,#PB_Canvas_Container|#PB_Canvas_Border|#PB_Canvas_Keyboard)
Global hscrollGrid=ScrollBarGadget(#PB_Any,0,0,0,20,0,0,100)
Global vscrollGrid=ScrollBarGadget(#PB_Any,0,0,20,0,0,0,100,#PB_ScrollBar_Vertical)     
CloseGadgetList()

MyTableGridRegister(mainWindow,canvasGrid,hscrollGrid,vscrollGrid,10000,100)

the "10000" are the rows, the "100" are the columns.
the special is the MyTableGridRegister.

if you want to resize the table, you only need to resize the canvas.

Re: My MyTable

Posted: Mon May 24, 2021 12:01 pm
by captain_skank
Thanks for the reply and pointers.

I've tried the following but no data is entered/visible on the rows :

Code: Select all

#MYTABLE_DEBUG = 0
#MYTABLE_DEBUG_LEVEL = 0

DebugLevel #MYTABLE_DEBUG_LEVEL

XIncludeFile "mytable.pbi"

Global mainWindow=OpenWindow(#PB_Any,0,0,1100,600,"MyTable",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget)

Global canvasGrid=CanvasGadget(#PB_Any, 5, 5, 1000, 500,#PB_Canvas_Container|#PB_Canvas_Border|#PB_Canvas_Keyboard)
Global hscrollGrid=ScrollBarGadget(#PB_Any, 0, 0, 0, 20, 0, 0, 100)
Global vscrollGrid=ScrollBarGadget(#PB_Any, 0, 0, 20, 0, 0, 0, 100,#PB_ScrollBar_Vertical)     
CloseGadgetList()

MyTableGridRegister(mainWindow, canvasGrid, hscrollGrid, vscrollGrid, 100, 0, #MYTABLE_TABLE_FLAGS_GRID|#MYTABLE_TABLE_FLAGS_MULTISELECT|#MYTABLE_TABLE_FLAGS_STOP_DRAWING|#MYTABLE_TABLE_FLAGS_ALL_ROW_COUNT);, 0, 1, "canvasgrid")

MyTableAddColumn(canvasgrid,"ID",0,#MYTABLE_COLUMN_FLAGS_RIGHT|#MYTABLE_COLUMN_FLAGS_INTEGER|#MYTABLE_COLUMN_FLAGS_RESIZEABLE)
MyTableAddColumn(canvasgrid,"Firma",0)
MyTableAddColumn(canvasgrid,"Vorname",0)
MyTableAddColumn(canvasgrid,"Nachname",0,#MYTABLE_COLUMN_FLAGS_RESIZEABLE)
MyTableAddColumn(canvasgrid,"Geburtsdatum",0)
MyTableAddColumn(canvasgrid,"Mail",0)
MyTableAddColumn(canvasgrid,"Telefon",0)


For i=1 To 100
  MyTableAddRow(canvasgrid, Str(i)+"|Firma "+Str(i)+"|Vorname "+Str(i)+#CRLF$+"|Nachname "+Str(i)+"|"+FormatDate("%dd.%mm.%yyyy",AddDate(Date(1980,1,1,0,0,0),#PB_Date_Day,i))+"|012345678-"+Str(i)+"|test"+Str(i)+"@test.de")
Next
MyTableRedraw(canvasgrid, #True)

MyTableAutosizeColumn(canvasgrid,#PB_Ignore)

Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow


MyTableUnRegister(canvasgrid)

Re: My MyTable

Posted: Mon May 24, 2021 5:28 pm
by Cyllceaux
Hey cap...

Oh... I see the Problem.

You init the table with 100 rows. Than you add 100 more.

There is a bug at my side... I will fix it.


But... Why do you need a Grid, when you add your own columns? You can use for this a simple table. The grid is for, when you know the size

Re: My MyTable

Posted: Mon May 24, 2021 5:59 pm
by Cyllceaux
Image

https://github.com/Cyllceaux/MyTable/
  • MyTable Tests in own Folder
  • MyTable now OO
  • Simple Formulas with Strings and Numbers
  • Fixes for Recalcs and Redraws
  • First draft for customizable cells

Re: My MyTable

Posted: Tue May 25, 2021 11:48 am
by Cyllceaux
Image
https://github.com/Cyllceaux/MyTable
  • Some Fixes
  • Customizable Formulas

Re: My MyTable

Posted: Tue May 25, 2021 11:54 am
by captain_skank
Cyllceaux wrote: Mon May 24, 2021 5:28 pm Hey cap...

Oh... I see the Problem.

You init the table with 100 rows. Than you add 100 more.

There is a bug at my side... I will fix it.


But... Why do you need a Grid, when you add your own columns? You can use for this a simple table. The grid is for, when you know the size
Doh!

Thanks - makes sense now.

But your grid is waaaay better than a listicongadget, and gives me more flexability going forward.

Code: Select all

Declare SelectCell(canvas,*row.strMyTableCell)

Procedure SelectCell(canvas,*row.strMyTableCell)
 
 Debug MyTableGetTableSelectedRow(canvas)
 Debug MyTableGetTableRowHeight(canvas)
 Debug MyTableGetCellText(canvas, MyTableGetTableSelectedRow(canvas)-1, 1)
 MyTableAutosizeRow(canvas,MyTableGetTableSelectedRow(canvas)-1)
 
EndProcedure



Global mainWindow=OpenWindow(#PB_Any,0,0,1100,600,"MyTable",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget)

Global canvasGrid=CanvasGadget(#PB_Any, 5, 5, 1000, 500,#PB_Canvas_Container|#PB_Canvas_Border|#PB_Canvas_Keyboard)
Global hscrollGrid=ScrollBarGadget(#PB_Any, 0, 0, 0, 20, 0, 0, 100)
Global vscrollGrid=ScrollBarGadget(#PB_Any, 0, 0, 20, 0, 0, 0, 100,#PB_ScrollBar_Vertical)     
CloseGadgetList()

MyTableGridRegister(mainWindow, canvasGrid, hscrollGrid, vscrollGrid, 0, 0, #MYTABLE_TABLE_FLAGS_GRID|#MYTABLE_TABLE_FLAGS_MULTISELECT|#MYTABLE_TABLE_FLAGS_STOP_DRAWING|#MYTABLE_TABLE_FLAGS_ALL_ROW_COUNT);, 0, 1, "canvasgrid")

MyTableAddColumn(canvasgrid,"ID",0,#MYTABLE_COLUMN_FLAGS_RIGHT|#MYTABLE_COLUMN_FLAGS_INTEGER|#MYTABLE_COLUMN_FLAGS_RESIZEABLE)
MyTableAddColumn(canvasgrid,"Firma",0)
MyTableAddColumn(canvasgrid,"Vorname",0)
MyTableAddColumn(canvasgrid,"Nachname",0,#MYTABLE_COLUMN_FLAGS_RESIZEABLE)
MyTableAddColumn(canvasgrid,"GeburtsdatumGeburtsdatum Geburtsdatum Geburtsdatum",0)
MyTableAddColumn(canvasgrid,"Mail",0)
MyTableAddColumn(canvasgrid,"Telefon",0)


For i=1 To 100
  MyTableAddRow(canvasgrid, Str(i)+"|Firma "+Str(i)+#CRLF$+"ABC"+"|Vorname "+Str(i)+#CRLF$+"|Nachname "+Str(i)+"|"+FormatDate("%dd.%mm.%yyyy",AddDate(Date(1980,1,1,0,0,0),#PB_Date_Day,i))+"|012345678-"+Str(i)+"|test"+Str(i)+"@test.de")
Next
MyTableRedraw(canvasgrid, #True)

MyTableAutosizeColumn(canvasgrid, #PB_Ignore)

For i=1 To 100
  MyTableAutosizeRow(canvasgrid, i-1)
Next


MyTableSetEventRowSelected(canvasgrid, @SelectCell())


Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow


MyTableUnRegister(canvasgrid)
A few more questions if i may :

Is there a way to reszize rows to column text for the whole grid ? as you can see from above, i used the MyTableAutosizeRow() method in a loop to acheive the same.

Also, when in use as a simple table, is there a way to click on a cell to select that particular row - just like clicking on the id column ?

Is there a way of returning the no of columns in a grid, I couldn't see a count column method ?

Congrats once again on this piece of work.

Re: My MyTable

Posted: Tue May 25, 2021 12:53 pm
by Cyllceaux
hey cap... yes

Code: Select all

MyTableAutosizeRow(canvas,#PB_Ignore)
MyTableAutosizeCol(canvas,#PB_Ignore)
No Columncount at the moment :)

Oh... btw...
When you click on the left or bottom border of a cell, the row/column resize from the content
and there is a different between: MyTableGridRegister and MyTableRegister

MyTableRegister => Table/Tree (all editable, sortable... and so on)
MyTableGridRegister => Grid/Datatable

Re: My MyTable

Posted: Wed May 26, 2021 8:40 am
by Cyllceaux
Image
Image
https://github.com/Cyllceaux/MyTable
  • fonts / colors
  • logical formula operators
  • performance tweaks

Re: My MyTable/MyGrid

Posted: Wed May 26, 2021 9:48 am
by STARGĂ…TE
Very nice project. I focused on the My Table Formula example and found some bugs:
  1. When I use the shortcut to navigate through the cells and move left, it do not stop in the first cell and gives an error after reaching a negative cell.
  2. The selection with the cursor is shifted by one cell to the right. Image
  3. Some calculations give wrong results:
    • "=4-2+3" gives "-1" but sould be "5"
    • "=8/2*3" gives "1.333" but should be "12"
    • "=(5-8)" gives "(-3)" and is not simplified to "-3"
    • When Cell D3 is -5 then "=D3+4" gives "-9" but should be "-1"
    • I can not mix a function like SUM with other arithmetic: "=SUM(C2:C8)+5" gives "28 + 5"
    • There are also some missing updates of cells when creating lots of relations, but I can imagine it is a big challenge.

Re: My MyTable/MyGrid

Posted: Wed May 26, 2021 11:11 am
by Cyllceaux
thx for the test...
  1. yes... (fixed)
  2. hu? oh... (partly fixed)
  3. Formula:
    • 4 - 2 + 3 = 5 (calc, google, bing, online-calculator, TI) (fixed)
    • 8/2*3 (fixed)
    • =(5-8) (fixed)
    • =D3+4 (fixed)
    • =SUM(C2:C8)+5 (fixed)
    • I will take a closer look