[Gambas-user] TableView Tag Property

Tobias Boege taboege at gmail.com
Wed Jan 13 22:31:26 CET 2021


On Wed, 13 Jan 2021, Gianluigi wrote:
> Il giorno mer 13 gen 2021 alle ore 21:56 Gianluigi <bagonergi at gmail.com> ha
> scritto:
> 
> >
> >
> > Il giorno mer 13 gen 2021 alle ore 20:29 Martin <mbelmonte at belmotek.net>
> > ha scritto:
> >
> >> I try the _GridView_Cell way using a variable declaration, even using
> >> properties (with read / write methods also) instead of variables but while
> >> it is possible to declare the properties or variables and add them to the
> >> original class, something doesn't quite work.
> >>
> >> I'll continue using .wordwarp for now as I can't understand why rewriting
> >> the class doesn't work.
> >> Thanks for the theory, it will surely serve me in many other
> >> opportunities.
> >>
> >
> > Here this works well, with Tobias's code
> > See attached project, zip to avoid problem...
> >
> 
> 
> Sorry Martin, I took the wrong pill today.
> You're right, it doesn't work.
> 
> I have too much faith in Tobias and have not controlled well.
> 

It worked insofar as a Tag property/variable was added to the global
_GridView_Cell class -- otherwise you would have gotten a runtime error
when accessing it.

The problem is found in the gb.gui.base source code for GridView:
_GridView_Cell is not a permanent object that lives inside the GridView
and stores the data associated to a cell. It is only a temporary object
that is created on-the-fly as a proxy to make modifications to the
real internal data structures of the GridView. Whatever data you store
in a _GridView_Cell object is wasted. The class we want to change is
called _GridView_Data. That's the permanent data storage for a cell.

The attached project now works. But it uses some more implementation
details of the GridView, which may change in a future Gambas and break
your code relying on them without warning. Use at your risk!

Best,
Tobias

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestGridView-0.0.4.tar.gz
Type: application/gzip
Size: 12279 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210113/6d6dadf7/attachment.gz>


More information about the User mailing list