[Gambas-user] Request: TableView cell offset

ron ronstk at ...239...
Thu Feb 12 03:34:19 CET 2004


On Wednesday 11 February 2004 21:10, Benoit Minisini wrote:
> On Wednesday 11 February 2004 19:16, ron wrote:
> > Hallo Benoit,
> >
> > I was so nice to try it myself.
>
> well done man :-)
>
> > Is is functional but I miss the way how to get the documentation also in
> > the helpbrowser. Do I have it done the right way for Benoit rulez?
>
> When you recompile a component, you must exec "gbi -a" in a shell to update
> the component *.info files. the help browser use these files to fill its
> treeview.

When I try I get a result for gb.net.info, gb.qt.ext.info and gb.sdl.info. The 
first two are re-compiled but the third isn't.
Segmentation fault occurs after this 3' one
I found gb.info has zero bytes. 
The info file creation work only good during make install after installing and 
compiling the 3 development files and before the help files are copied.
A retry after finishing all give the same segmentation fault again.
(with the orginal 0.8.3 with only the CFont update to)

>
> > BTW
> > In the code I found after all this part of code
> > BEGIN_PROPERTY(CTABLEITEM_y)
> >   GB.ReturnInteger(WIDGET->rowPos(THIS->row) - WIDGET->contentsY() +
> > WIDGET->clipper()->y());
> > END_PROPERTY
> > Here it is just done the oposit way
> > When this function didn't substract contentsY and add clipper()->y()
> > it was posible to iterate the way i did in my example.
>
> This function returns the pos of an item in tableview coordinates.
>
> rowPos() returns the pos in contents coordinates. So I must substract
> contentsY() to go viewport coordinates, and then add clipper()->y() to go
> to TableView coordinates.
>
> It is hard for me to explain that in english. Read the QScrollView
> documentation in the QT doc to get more explanations.

contentsX/Y is the position relative to top/left cell of the table area and is 
the top/left of the viewport. (here I see it as the scroll x/y position).
The clipper() is the white space in the TableView and clipper()->x/y is the
top/left in the TableView control for that whitespace.
This way clipper()->width/height must be the white space where to grid is. 
They say clipper()->x/y is old and advise to use visibleWidth/Height.

 --8< --8<--
> >
> > BEGIN_METHOD(CTABLEVIEW_columnat, GB_INTEGER xpos)
> > 	int xpos = VARG(xpos);
> > 	xpos = xpos + WIDGET->contentsX();
> > 	if (!WIDGET->verticalHeader()->isHidden())
> > 		xpos = xpos - WIDGET->verticalHeader()->width();
> > 	int	col = WIDGET->columnAt(xpos);
> > 	GB.ReturnInteger(col);
> > END_PROPERTY
>
> Maybe there is a problem, because I'm not sure that header width() and
> height() are valid when the TableView is not yet shown. And so these
> methods will return incorrect values in a _new() or Form_Open() method.

If not yet shown how to click on it? :-----)

>
> This a problem with many QT complex widgets, whose layout is deferred the
> later as possible.
>
> This is a reason I didn't used these methods in CTABLEITEM_X/Y

At first time I used the THIS->columnHeight(0) and rowWidth(0) for it.
Then I found your code and believed that should a better way, what if no 
rows/columns are set?. :-( 
The value I need is the same as in BEGIN_PROPERTY(CTABLEROWS_width)
There you did use this method to get it.

>
> > /* add ron end */
--8<--
> > /* add ron end */
>
> I will insert your functions in the next version. But tell me if they work
> during a _new() method.
>
> Regards,

I can't test during the _new. 
Before there is no tableview to click and after _new it is and should work
In this case the press is in the white space and as mentioned on top it will 
returns -1 for RowAt() and ColumnAt() by QT. So this must be save to use.

---
Ron






More information about the User mailing list