[Pas2js] some thoughts about htmlwidgets

Michael Van Canneyt michael at freepascal.org
Sun Oct 11 12:52:41 CEST 2020



On Sat, 10 Oct 2020, Mgr. Janusz Chmiel wrote:

> Dear MR Van Canneyt,
> 	Thank you very much for yours briliant programmers work. You are not
> only working on yours commercial applications, but you are even bringing
> high quality units and programming examples to The opensource community and
> you are helping me to create GUI which is fully accessible and even
> acceptable for sighted majority. Thank you for yours programmers efford and
> for yours good will to help others around you.

A little later than I would have wanted to, but anyway: I added 2 table
widget demos. The first demo uses a TEventTableWidget: all data for the
table cells is retrieved using an event. You just define the columns, set
the number of rows you want, and in the event you return the data for a
particular cell.

The demo illustrates how you could use this to populate a table with 10
questions and 10 input boxes for the answers: it takes less than 10 lines of
code.

The second demo illustrates a TSTringsTableWidget. It more or less mimics
the TStringGrid found in the LCL/VCL: you can set columns/rows and fill the
table cells with strings.
I've applied some bootstrap styles to it, so it looks 'nice' for sighted people, 
but you should be able to examine the table as well with your screen reader.
(I hope)

The online demo at
https://www.freepascal.org/~michael/pas2js-demos/widgets/
has been updated so it contains the 2 demos.

a TDBTableWidget and TDBSelectWidget demo will also still be added. 
As the name suggests, they show the contents of a dataset.

Note that these widgets are read-only at the moment, because this is how I
use them in my company. We never allow editing in a grid/table. The
components currently still reflect this, but I am open for suggestions on how
to make them editable. I have planned many other refinements, but these
components are currently used as-is in production websites.

Michael.


More information about the Pas2js mailing list