Database to show with changing column width Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Wolfgang
Earned some good credits
Earned some good credits
Posts: 100
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang » Thu Feb 21, 2019 8:00 am

Did now manage to distinguish between left and right click,


But at the moment only possible if really clicked and not if holded down or double clicked. So any help there would be appreciated.

User avatar
doublemax
Moderator
Moderator
Posts: 13990
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Database to show with changing column width

Post by doublemax » Thu Feb 21, 2019 8:06 am

With wxHtmlCellEvent::GetMouseEvent() you should be able to distinguish between different types o clicks.

https://docs.wxwidgets.org/trunk/classw ... event.html

BTW: wxHtmlWindow only understands HTML 1.0, so your styling options will be limited. It will also be quite slow if you have a table with thousands of rows when you resize the window. Consider wxWebView instead which uses the underlying native browser.
Use the source, Luke!

Wolfgang
Earned some good credits
Earned some good credits
Posts: 100
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang » Thu Feb 21, 2019 8:14 am

Was thinking of not showing all at once and only show those which requested.
Must check if this is possible to generate the html on request just in memory.

User avatar
doublemax
Moderator
Moderator
Posts: 13990
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Database to show with changing column width

Post by doublemax » Thu Feb 21, 2019 8:20 am

Must check if this is possible to generate the html on request just in memory.
That's the way to go anyway. Don't create temporary HTML files on disc.

However, this has no effect on the render speed.
Use the source, Luke!

Wolfgang
Earned some good credits
Earned some good credits
Posts: 100
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang » Thu Feb 21, 2019 8:24 am

doublemax wrote:
Thu Feb 21, 2019 8:06 am
With wxHtmlCellEvent::GetMouseEvent() you should be able to distinguish between different types o clicks.

https://docs.wxwidgets.org/trunk/classw ... event.html

BTW: wxHtmlWindow only understands HTML 1.0, so your styling options will be limited. It will also be quite slow if you have a table with thousands of rows when you resize the window. Consider wxWebView instead which uses the underlying native browser.
Yes, made it like that:

Code: Select all

void MyFrame::OnHtmlCellClicked(wxHtmlCellEvent &event)
{	wxMouseEvent testm = event.GetMouseEvent();
	if (testm.GetEventType() == wxEVT_RIGHT_UP) {
and wxEVT_LEFT_UP are working

wxEVT_LEFT_DCLICK not working
wxEVT_RIGHT_DOWN not working

Wolfgang
Earned some good credits
Earned some good credits
Posts: 100
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang » Thu Feb 21, 2019 8:26 am

doublemax wrote:
Thu Feb 21, 2019 8:20 am
Must check if this is possible to generate the html on request just in memory.
That's the way to go anyway. Don't create temporary HTML files on disc.

However, this has no effect on the render speed.
Just rendering about 150 rows at once, that should be quick enough.

Wolfgang
Earned some good credits
Earned some good credits
Posts: 100
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang » Thu Feb 21, 2019 8:27 am

Just in case you did not notice started c++ programming two weeks ago, and only 3 to 4 hours a day. So that is why I wrote I still have to check if it is possible.

User avatar
doublemax
Moderator
Moderator
Posts: 13990
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Database to show with changing column width

Post by doublemax » Thu Feb 21, 2019 8:34 am

I just looked into the source code and yes, wxHtmlWindow does not handle these events, so you'll have to catch them yourself.

Check <wxdir>/src/html/htmlwin.cpp to see how to find the htmlcell where the click occurred.
Use the source, Luke!

Wolfgang
Earned some good credits
Earned some good credits
Posts: 100
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang » Thu Feb 21, 2019 8:38 am

wxwebview

Can I also get the clicks like with wxhtml, in the sample this is not included, that is why I ask.
Last edited by Wolfgang on Thu Feb 21, 2019 8:40 am, edited 1 time in total.

Wolfgang
Earned some good credits
Earned some good credits
Posts: 100
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang » Thu Feb 21, 2019 8:40 am

doublemax wrote:
Thu Feb 21, 2019 8:34 am
I just looked into the source code and yes, wxHtmlWindow does not handle these events, so you'll have to catch them yourself.

Check <wxdir>/src/html/htmlwin.cpp to see how to find the htmlcell where the click occurred.
htmlwin.cpp sample I do not have, have to check on github and download it.

User avatar
doublemax
Moderator
Moderator
Posts: 13990
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Database to show with changing column width

Post by doublemax » Thu Feb 21, 2019 8:41 am

htmlwin.cpp sample I do not have, have to check on github and download it.
It's not a sample, it's part of the wxWidgets source code.
Use the source, Luke!

Wolfgang
Earned some good credits
Earned some good credits
Posts: 100
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang » Thu Feb 21, 2019 7:10 pm

If I did see it right:
wxHTMLCtrl can only load from disc, does not accept File system handlers registration.
wxWEbview cannot handle cell clicks nativ like wxhtmlctrl can, right?
So basically both are only to work if I manage to get the missing part to work, or did I miss something?

User avatar
doublemax
Moderator
Moderator
Posts: 13990
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Database to show with changing column width

Post by doublemax » Thu Feb 21, 2019 7:20 pm

wxHTMLCtrl can only load from disc, does not accept File system handlers registration.
You can pass a string with HMTL code to wxHtmlWindow through wxHtmlWindow::SetPage(), which should be all you need for your task. In addition to that it does support loading files through wxFileSystem, e.g. wxMemoryFileSystem.
Use the source, Luke!

Wolfgang
Earned some good credits
Earned some good credits
Posts: 100
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang » Sat Feb 23, 2019 9:13 pm

So far htmlwindow working, I can get clicks, but the question is now, how can I find out the word which is under the mouse van clocked or by hoover event. And the next question is there a way, that I can somehow give a word or number to a woord, or can i catch the link, so it does not try to call the link. As I could write in there additional information.

Wolfgang
Earned some good credits
Earned some good credits
Posts: 100
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang » Sat Feb 23, 2019 9:21 pm

Another question, how to set part of the text right to left (for hebrew text)
Last edited by Wolfgang on Sun Feb 24, 2019 7:24 pm, edited 1 time in total.

Post Reply