Bug #5279
closedCatching double click in WTableCell
0%
Description
I derived classes from both WTable and WTableCell. I added createCell to keep track of the grid row/column information.
Wt::WTableCell* WtTable::createCell( int row, int column )
{
//return new Wt::WTableCell();
return new WtTableCell( *view, row, column );
Should this work?
Updated by Gunnar Skogsholm over 8 years ago
class WtTableCell : public Wt::WTableCell
{
private:
DataView* view;
int Row;
int Column;
public:
WtTableCell( DataView& TheView, int row, int column );
void double_click( const Wt::WMouseEvent& e );
};
Updated by Gunnar Skogsholm over 8 years ago
@WtTableCell::WtTableCell( DataView& TheView, int row, int column )
: view( &TheView ),
Row( row ),
Column( column )
{
doubleClicked().connect( this, &WtTableCell::double_click );
}
void WtTableCell::double_click( const Wt::WMouseEvent& e )
{
@
Updated by Gunnar Skogsholm over 8 years ago
I've narrowed it down to the row value being passed in as: 0xffffffff
The Wt function rowNum seems to be culprit.
WTableCell *WTableRow::createCell(int column)
{
return table_->createCell(rowNum(), column);
}
Updated by Gunnar Skogsholm about 8 years ago
I'm stuck on this point. There is simply not enough documentation about how cells get created.
This function is getting called multiple times with row basically set to --1 (0xffffffff). I thought maybe this was for a header row, but it happens whether I call setHeaderCount or not. Even if it were for a header, why more than one?
Updated by Gunnar Skogsholm about 8 years ago
Frustrated to not get any response. Searching wt examples, createCell is never used. Should I not be using this approach:
auto tableCell = gridCtl->elementAt( Rec, left() ); // triggers WtTable::createCell
tableCell->addWidget( staticWnd );
In the debugger, I see that createCell is called multiple times for one call to elementAt. I realize that it's expanding to fill cells up to where I've accessed. However, if I start with 0,0 which calls CreateCell with 0,0, then later call elementAt(1,0), I would not expect it to call CreateCell with 0,0 again.
It appears to be a bug, but I could be looking at this all wrong. ANY help would be greatly appreciated.
Updated by Koen Deforche about 8 years ago
- Assignee set to Koen Deforche
Hey,
Can you see if the following changes fixes this for you:
swap the two lines:
tableRow->expand(columnCount());
rows_.insert(rows_.begin() + row, tableRow);
at (approx. lines 114-115) in
WTable::insertRow(int row, WTableRow *tableRow)
If this doesn't help, can you provide a small self-contained example that illustrates the problem?
Updated by Gunnar Skogsholm about 8 years ago
This change fixed the issue I was seeing. There are no --1s being passed in now. All is well. Thank you so much!
Updated by Koen Deforche about 8 years ago
- Tracker changed from Support to Bug
- Status changed from New to Implemented @Emweb
- Target version set to 3.3.7
Updated by Koen Deforche about 8 years ago
- Status changed from Implemented @Emweb to Resolved
Updated by Roel Standaert over 7 years ago
- Status changed from Resolved to Closed