Page 1 of 1

How to delete rows,columns and table's?

Posted: Mon Dec 16, 2013 10:00 pm
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

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

Posted: Tue Dec 17, 2013 2:47 pm
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

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

Posted: Tue Dec 17, 2013 6:04 pm
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.

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

Posted: Tue Dec 17, 2013 8:41 pm
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/

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

Posted: Tue Dec 17, 2013 9:20 pm
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.

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

Posted: Mon Dec 23, 2013 1:05 am
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.

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

Posted: Mon Dec 23, 2013 2:51 pm
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.

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

Posted: Wed Feb 24, 2016 8:21 am
by abaddon1234