WTableView cannot select anything
Added by Mark Petryk 27 days ago
Running Wt from Thu Apr 24th...
I have recompiled my working program with this version of Wt and suddenly my WTableView cannot select any rows.
I'm not sure what changed, or where to begin looking... There are notes in the 'git log' indicating some work was done on the WTableView, but it doesn't seem to be due to selection handling or anything.
Replies (11)
RE: WTableView cannot select anything - Added by Mark Petryk 27 days ago
I'll make a small test case and see if I can reproduce it.
RE: WTableView cannot select anything - Added by Mark Petryk 27 days ago
This is a simple test for the WTableView.
(see attached image)
Not sure what I'm missing here, this just started after upgrading Wt. I replaced the wt 'resources' folder in my project, so that is updated as well..
136 auto
137 test()-> void
138 {
139 auto model = std::make_shared< Wt::WStandardItemModel >();
140 for( int row = 0; row< 3; row++ )
141 {
142 std::vector< std::unique_ptr< Wt::WStandardItem > > rowset;
143 for( int col = 0; col< 3; col++ )
144 {
145 auto item = std::make_unique< Wt::WStandardItem >( Wt::WString("row{1} col{2}").arg( row ).arg( col) );
146 rowset.push_back( std::move( item ) );
147 }
148
149 model-> appendRow( std::move( rowset ) );
150 }
151
152 auto tableView = std::make_unique< Wt::WTableView >();
153 tableView-> setSelectionBehavior ( Wt::SelectionBehavior::Items );
154 // tableView-> setSelectionBehavior ( Wt::SelectionBehavior::Rows );
155 // tableView-> setSelectionMode ( Wt::SelectionMode::Single );
156 tableView-> setSelectionMode ( Wt::SelectionMode::Extended );
157 tableView-> setColumnResizeEnabled ( false );
158 tableView-> setAlternatingRowColors ( true );
159 tableView-> setModel ( model );
160
161 Wt::WDialog dialog( "test" );
162 dialog.contents()-> addWidget( std::move( tableView ) );
163 dialog.rejectWhenEscapePressed( true );
164 dialog.setClosable( true );
165 dialog.exec();
166
167 } // endtest()-> void
Selection_1339.png (13.6 KB) Selection_1339.png |
RE: WTableView cannot select anything - Added by Mark Petryk 27 days ago
Sorry for the noise... this appears to be a problem on my end. Not sure what's going on, but on one PC, any browser, Chrome, FF, I cannot click in the table. Even from a VM on that PC it won't work. But, when I access from just a different box, it works, I can click and select rows... Very odd! If I figure it out, I'll post back here.
RE: WTableView cannot select anything - Added by Mark Petryk 25 days ago
Hmm, well, in my app, WTableView selection doesn't work! When I build a simple test within my app, it still doesn't work. When I move that simple test case to its own stand-alone app, it works without any problems!
So, I'm confused what has cropped up in my app that preventing WTableView Selection?
Ugh!
RE: WTableView cannot select anything - Added by Mark Petryk 22 days ago
Ok, found it!
Yes, it was due to Wt upgrade, but the problem was due to having an older-version 'resources' folder. Finally got that properly swapped, all fixed!
Sorry for the noise.
RE: WTableView cannot select anything - Added by Mark Petryk 21 days ago
Interesting result... I have further investigation to do;
1. compile with Wt-4.10 no problem
2. compile with Wt-4.11 will not compile with error below
3. compile with Wt-master, WTableView will not allow 'select' anything
I verified this with a docker container of Wt, so I can quickly swap out Wt versions and test (thank you Roel)
This is the error that gets thrown on compile from 4.11;
from src/Gui/CentralWidget.cpp:8:
/opt/Wt4/include/Wt/WToolBar.h: In instantiation of 'Widget* Wt::WToolBar::addWidget(std::unique_ptr<_Tp>, Wt::AlignmentFlag) [with Widget = Wt::WLineEdit]':
src/Gui/RawTableWidget_impl.h:30:24: required from 'GCW::Gui::RawTableWidget<C>::RawTableWidget(const string&) [with C = GCW::Dbo::Accounts::Item; std::string = std::__cxx11::basic_string<char>]'
/usr/include/c++/11/bits/unique_ptr.h:962:30: required from 'typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = GCW::Gui::RawTableWidget<GCW::Dbo::Accounts::Item>; _Args = {const char (&)[9]}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<GCW::Gui::RawTableWidget<GCW::Dbo::Accounts::Item>, std::default_delete<GCW::Gui::RawTableWidget<GCW::Dbo::Accounts::Item> > >]'
src/Gui/CentralWidget.cpp:386:105: required from here
/opt/Wt4/include/Wt/WToolBar.h:75:20: error: no matching function for call to 'std::unique_ptr<Wt::WWidget>::unique_ptr(std::remove_reference<std::unique_ptr<Wt::WLineEdit>&>::type, Wt::AlignmentFlag&)'
75 | addWidget(std::unique_ptr<WWidget>(std::move(widget), alignmentFlag));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
This is the code that compiles fine in Wt-4.11 and also compiles fine in Wt-master;
386 tw-> addTab( std::make_unique< GCW::Gui::RawTableWidget< typename GCW::Dbo:: Accounts ::Item > >( "accounts" ), "accounts" );
387 #ifdef NEVER
388 tw-> addTab( std::make_unique< GCW::Gui::RawTableWidget< typename GCW::Dbo:: Books ::Item > >( "books" ), "books" );
389 tw-> addTab( std::make_unique< GCW::Gui::RawTableWidget< typename GCW::Dbo:: BillTerms ::Item > >( "billterms" ), "billterms" );
390 tw-> addTab( std::make_unique< GCW::Gui::RawTableWidget< typename GCW::Dbo:: Commodities ::Item > >( "commodities" ), "commodities" );
391 tw-> addTab( std::make_unique< GCW::Gui::RawTableWidget< typename GCW::Dbo:: Customers ::Item > >( "customers" ), "customers" );
392 tw-> addTab( std::make_unique< GCW::Gui::RawTableWidget< typename GCW::Dbo:: Entries ::Item > >( "entries" ), "entries" );
393 tw-> addTab( std::make_unique< GCW::Gui::RawTableWidget< typename GCW::Dbo:: GncLock ::Item > >( "gnclock" ), "gnclock" );
394 tw-> addTab( std::make_unique< GCW::Gui::RawTableWidget< typename GCW::Dbo:: Invoices ::Item > >( "invoices" ), "invoices" );
395 tw-> addTab( std::make_unique< GCW::Gui::RawTableWidget< typename GCW::Dbo:: Slots ::Item > >( "slots" ), "slots" );
396 tw-> addTab( std::make_unique< GCW::Gui::RawTableWidget< typename GCW::Dbo:: Splits ::Item > >( "splits" ), "splits" );
397 tw-> addTab( std::make_unique< GCW::Gui::RawTableWidget< typename GCW::Dbo:: Transactions ::Item > >( "transactions" ), "transactions" );
398 tw-> addTab( std::make_unique< GCW::Gui::RawTableWidget< typename GCW::Dbo:: Vars ::Item > >( "vars" ), "vars" );
399 tw-> addTab( std::make_unique< GCW::Gui::RawTableWidget< typename GCW::Dbo:: Versions ::Item > >( "versions" ), "versions" );
400 #endif
401
So, this really has my curiosity piqued now! I'm going to dig a little deeper and see what I can understand.
Thank you for listening. I'll be here all week :)
~mark
RE: WTableView cannot select anything - Added by Matthias Van Ceulebroeck 21 days ago
Hey Mark,
the compilation error was due to a an additional shorthand for addWidget
being implemented that returned the raw pointer to the widget. However, as you can see, the closing bracket after the std::move
is badly positioned, taking the alignmentFlag
into the WWidget
ctor.
While it should be a parameter of addWidget
. A silly oversight.
But if I understand it correctly, you are still not able to select WTableView
entries, even after replacing the resources
directory (per your 3rd point)?
Best,
Matthias
RE: WTableView cannot select anything - Added by Mark Petryk 20 days ago
Hi Matthias,
Yes, in wt-master I seem to be unable to select anything in a WTableView.
I'm still researching this. I built a small test case that did not seem to exhibit this problem, and now I'm working on my app to test this thoroughly and I'm getting mixed results - I could select rows, and then I couldn't. It seems very app related, but I cannot right now see it, and the fact that it reveals itself from a version change seems odd. Seems Wt related, but also something clearly in my code is aggravating this situation.
In my app, in one condition, I can select rows in my tables, and then when my app take a different direction, then I cannot select rows in the WTableViews. Seems app related, right? But, if I compile down to 4.10, then this situation does not arise at all... seems Wt related, right?
Color me confused! As soon as I have something conclusive I'll send it along.
Thanks for checking in!
~mark
RE: WTableView cannot select anything - Added by Mark Petryk 20 days ago
Hi Matthias,
Yea, this is really strange.
Here is a link to a page that is exhibiting the issue. This same application compiles with 4.10 and works without any issues;
https://gnucashew.lorimarksolutions.com/demo
If you want to see if you can see anything in the DOM go for it.
I'm still analyzing things, I'm very curious about this issue.
Thank you,
~mark
RE: WTableView cannot select anything - Added by Mark Petryk 20 days ago
Oh... if you go to that page, there's a 'button' called 'devtest', and that will open a simple table for testing.
RE: WTableView cannot select anything - Added by Mark Petryk 17 days ago
Ok, here's a twist...
On that demo site, I can poke around, click on things, open 'help', 'properties', various reports and things. Just poking around. Still cannot select items in the WTableView.
But, then, all of a sudden, without warning, without indication... suddenly... I can click and select things!
Again, this doesn't happen in 4.10, 4.11... just 'master'.
Very strange!
Still studying.