How to delete rows,columns and table's?

Guiserver, GTK-server, OpenGL, PostScript,
HTML 5, MIDI, IDE
Locked
fdb
Posts: 66
Joined: Sat Nov 09, 2013 8:49 pm

How to delete rows,columns and table's?

Post by fdb »

How can i delete rows and/or columns in a gs:table? there seems to be only the option to add them..or am i missing something? Furthermore i cannot delete a gs:table when i try to do so with gs:dispose i get the message
dispose cannot be applied to MAIN:row-table

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: How to delete rows,columns and table's?

Post by Lutz »

Only entire containers created with gs:window, gs:frame and gs:dialog can be used with gs:dispose - this has now been added to the documentation.

At the moment there is no API to delete table rows or columns. For other dialog components use gs:remove-from, or use gs:delete-tag to remove 2D drawn objects.

Se also: http://www.newlisp.org/guiserver/guiserver.lsp.html

fdb
Posts: 66
Joined: Sat Nov 09, 2013 8:49 pm

Re: How to delete rows,columns and table's?

Post by fdb »

Thx for the reply, i'll dispose the frame and rebuilt it after i've recalculated the UI.

I also saw there seemed to be no option to have a table without column headers, but you can actually achieve this with an empty string "" as the column header so

Code: Select all

(gs:table 'row-table 'gs:no-action "" "")
will give you a table with two columns but you don't see the column header.

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: How to delete rows,columns and table's?

Post by Lutz »

Currently when adding columns using gs:table-add-column, the column number will be added as a label when specifying an empty string.

In the next version of guiserver.jar the header will be suppressed if an empty string is used with gs:table-add-column. This will make it possible to add columns to header-less tables created with a gs:table statement using empty string headers.

See: http://www.newlisp.org/downloads/develo ... nprogress/

fdb
Posts: 66
Joined: Sat Nov 09, 2013 8:49 pm

Re: How to delete rows,columns and table's?

Post by fdb »

Great! Are you also planning to add the ability to delete rows and columns? At the moment i dispose the frame and then recalc and recreate the frame , which doesn't matter too much because i have to recalc all the tables (6) anyway but it does of course means flickering.

fdb
Posts: 66
Joined: Sat Nov 09, 2013 8:49 pm

Re: How to delete rows,columns and table's?

Post by fdb »

Hi , i've added the ability to delete rows and columns in a table in a build i made in 10.5.4
I have added the following methods to Dispatcher.java:

Code: Select all

methods.put("table-remove-row", "tableRemoveRow"); //deleting of a row
methods.put("table-set-column-name", "tableSetColumnIdentifiers");//add/delete/update
methods.put("table-set-rows", "tableSetRowCount"); //adding /deleting rows
and implemented them in TableWidget.java.

Then i've coded the new functions in newlisp in guiserver.lsp.
After compiling the java stuff and make /make build, everything seems to work!

I was surprised how easy this was and am very impressed by the documentation and the clean code, everything 'just works' ;-)

Be aware that i'm not a professional programmer so who knows what errors I made but if Lutz is interested i'll be more then happy to share my code to include this in future versions.

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: How to delete rows,columns and table's?

Post by Lutz »

Thanks very much fdb.

You can package TableWidget.java, guiserver.lsp and table-demo.lsp into a .zip or a .tgz file and mail it to me at lutz@nuevatec.com or publish the files else if you prefer.

Keep the description in guiserver.lsp short but add buttons and input to table-demo.lsp showing the new functionality. This way people have an example to work off and it also can be used to test the new functionality.

abaddon1234
Posts: 21
Joined: Mon Sep 14, 2015 3:09 am

Re: How to delete rows,columns and table's?

Post by abaddon1234 »


Locked