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
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Database to show with changing column width

Post by Wolfgang »

Hello

I'm hopeing for some ideas how to achieve this the best.
All the text is in a database, therefore I posted the question also here, as there might be a solution close to a database possible as well.

I want to show bible texts below each other. Some of the texts should be editable, with hoovering over it, it should show some additional information.
So far I know I could come with wxDataViewCtrl and with a own model.
To hide the column names I did not find, but I think that should be possible as well.
But the problem I have is there a way to change the length for each column after the text inside this row?
Otherwise it would sometimes be to much space between the texts.
Or is there a other way to achieve that?
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Database to show with changing column width

Post by doublemax »

Using wxDataViewCtrl for text would definitely be unusual, but i see how it could make sense in your case.

If i understand you correctly, you want two columns, the first one containing one sentence/verse per row and the second column with editable comments?
But the problem I have is there a way to change the length for each column after the text inside this row?
Otherwise it would sometimes be to much space between the texts.
I don't understand this. Can you explain a little more what the problem is?
Use the source, Luke!
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang »

I want the width of the column seperate in each row.

Code: Select all

To explain the difference
Column1          Column2    Column3
I                was        ready
Extraordinary    superlong  column
But should be:

Code: Select all

I was ready
Extraordinary superlong column
Last edited by Wolfgang on Tue Feb 19, 2019 7:26 pm, edited 3 times in total.
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Database to show with changing column width

Post by doublemax »

I want the width of the column seperate in each row.
That's impossible in any list based control and it sounds like a horrible GUI anyway.

And i still don't think you need (or even want) this.

Can you make a scribble or something of what you have in mind?
Use the source, Luke!
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang »

It should show a bible text, but some of the bilbe texts should be changeable. And when hovering over it should show additional information to that word.

Other approach would be with a normal textbased gui, but there again, the bibles will be in an sqlite database, at the moment not sure if only database or in a variable, will depend on speed.
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang »

doublemax wrote: Mon Feb 18, 2019 2:23 pm Using wxDataViewCtrl for text would definitely be unusual, but i see how it could make sense in your case.

If i understand you correctly, you want two columns, the first one containing one sentence/verse per row and the second column with editable comments?
But the problem I have is there a way to change the length for each column after the text inside this row?
Otherwise it would sometimes be to much space between the texts.
I don't understand this. Can you explain a little more what the problem is?
Even worse than that, I want words belonging to a (strongs number) in a column (so different numbers of columns as well), and every verse in a new row.
As I work on a translation myself I need the bible text changeable.
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang »

doublemax wrote: Tue Feb 19, 2019 6:50 am
I want the width of the column seperate in each row.
That's impossible in any list based control and it sounds like a horrible GUI anyway.

And i still don't think you need (or even want) this.

Can you make a scribble or something of what you have in mind?
Why I cannot quickly think of a better way, I asked here, what all of you would suggest for the problem.
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: Database to show with changing column width

Post by utelle »

Wolfgang wrote: Tue Feb 19, 2019 8:58 am
doublemax wrote: Tue Feb 19, 2019 6:50 am
I want the width of the column seperate in each row.
That's impossible in any list based control and it sounds like a horrible GUI anyway.

And i still don't think you need (or even want) this.

Can you make a scribble or something of what you have in mind?
Why I cannot quickly think of a better way, I asked here, what all of you would suggest for the problem.
First of all, this thread is not database related at all. It has to do with designing the user interface of your application, only. Where the dispalyed data are stored doesn't matter in this context.

Second, as doublemax already pointed out it is simply impossible to have varying column widths for each displayed row. What you could do would be to display a list with selection criteria in a typical list control, and as soon as a row in the list is selected the text belonging to the selection could be displayed in a separate multi-line text control.

However, I have to admit that I don't have a clue what exactly you try to accomplish. It would really help if you could draw a sketch (with some drawing tool or simply with pencil and paper) of what you have in mind.

Regards,

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

Re: Database to show with changing column width

Post by doublemax »

But the problem I have is there a way to change the length for each column after the text inside this row?
Otherwise it would sometimes be to much space between the texts.
I think i know what you mean now. You're thinking of displaying each verse(?) in a single line.

I however, thought about displaying the variable length text in a multiline display.
table1.png
table1.png (23.09 KiB) Viewed 19151 times
table2.png
table2.png (21.81 KiB) Viewed 19151 times
This can be done with wxDataViewCtrl, but you'll need a custom renderer for the multiline text.
Use the source, Luke!
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang »

Here again so it is also to see.

I want the width of the column seperate in each row.

Code: Select all

To explain the difference
Column1          Column2    Column3   Column4
I                was        ready
Extraordinary    superlong  column    test
But should be:

Code: Select all

I was ready
Extraordinary superlong column
Every woord should be editable and it should be possible to create hoover over.
Other idea I had, is to create wxtextctrl for all words, and make basically my own dataviewctrl.
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Database to show with changing column width

Post by doublemax »

Other idea I had to create wxtextctrl for all words, and make basically my own dataviewctrl.
Before you start with bad workarounds, think about what would be best for the user.
Every word should be editable and it should be possible to create hover over.
At this point i would consider using a HTML based control. With standard GUI elements this will be hard to do.
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Database to show with changing column width

Post by ONEEYEMAN »

Hi,
Wolfgang wrote: Tue Feb 19, 2019 7:30 pm Here again so it is also to see.

I want the width of the column seperate in each row.

Code: Select all

To explain the difference
Column1          Column2    Column3   Column4
I                was        ready
Extraordinary    superlong  column    test
But should be:

Code: Select all

I was ready
Extraordinary superlong column
There is no standard control that can do that. Even Excel-like controls (wxGrid) do not support this layout.
Everything is table-based.
Wolfgang wrote: Tue Feb 19, 2019 7:30 pm Every woord should be editable and it should be possible to create hoover over.
Other idea I had, is to create wxtextctrl for all words, and make basically my own dataviewctrl.
You cam do that - put you layout with a huge number of text control in the wxScrolled<>. The only problem is - on Windows there is a restriction - you can't create more than 65K controls,
You can create controls on demand and add them to the wxScrolled<> and remove the one that goes off the visible area, but this will be more hassle and more work for no gain. An application will eventually slow down significantly.

So you need to re-think the design of you application.

I'd make it so that every verse be in one cell of either wxDataViewCtrl or wxListCtrl and the edit it in wxDialog.

Thank you.
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang »

doublemax wrote: Tue Feb 19, 2019 7:38 pm
Other idea I had to create wxtextctrl for all words, and make basically my own dataviewctrl.
Before you start with bad workarounds, think about what would be best for the user.
Every word should be editable and it should be possible to create hover over.
At this point i would consider using a HTML based control. With standard GUI elements this will be hard to do.
Is it possible in HTML based control to make it editable, the rest seams exactly what I need. Thank you for pointing me in that direction, could open a separate frame for editing, if it is not possible otherwise.
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Database to show with changing column width

Post by doublemax »

Is it possible in HTML based control to make it editable[...]?
You'd have to do that on the browser side with Javascript. Definitely possible, but not trivial.
[...]could open a separate frame for editing, if it is not possible otherwise.
That would be pretty simple. Just turn the whole text (or even individual words) into links and use a custom "virtual" URL as link. E.g. "/edit_text?id=177". Then you catch the wxEVT_WEBVIEW_NAVIGATING event, check the url, and if it's this custom link, you open an edit dialog. After editing you rebuild the whole HTML.
Use the source, Luke!
Wolfgang
I live to help wx-kind
I live to help wx-kind
Posts: 180
Joined: Mon Jan 28, 2019 8:22 am

Re: Database to show with changing column width

Post by Wolfgang »

Ok,I looked now at the test sample of wxHTMLWindow, and it looks like there I can get out what I need.

The only problem I see now, if there are ways to distinguish between Clicked, right clicked and double clicked, as I usually will need all 3.

OnHtmlCellClicked
or
ONHtmlLinkClicked

There is somehow make a difference between left and right click, as with left click the link gets opened, with right click it does not get opened, but with both he writes into the log window the same.

But there are no seperate events for catching double click or right click on a cell, or am I missing that, or how can that be implemented?
Post Reply