Two Panel GUI ... ongoing

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.
Post Reply
runeight
Earned a small fee
Earned a small fee
Posts: 22
Joined: Sat Apr 11, 2020 5:53 pm

Two Panel GUI ... ongoing

Post by runeight » Sat Apr 25, 2020 1:06 am

As I develop this app, I find a few questions along the way....

1) I am using dataviewlistctrl to display and select lines of text. All working as expected. The widget is constructed as single selection. I would like to go into a mode where it is multi selection and then revert back. I have looked at the class ref and searched here a bit. I don't see a func that would allow me to do this on the fly. Is that possible?

2) I am using a statictext for a popup. The text widget is inside a sizer inside a frame. The popup works great and I can put a title into the title bar. I can also have more than one popped up at one time. But, when I create this widget hierarchy in wxFB, I select the VScroll option on the statictext. The popup does indeed have the scroll bar, but it doesn't scroll. I am missing a step. Is there a flag to tell the statictext to actually scroll?? Or, perhaps, another widget needed in the stack?

Thanks.

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

Re: Two Panel GUI ... ongoing

Post by doublemax » Sat Apr 25, 2020 8:33 am

1) You can try wxWindow::ToggleWindowStyle(), but not all flags can be changed after window creation
https://docs.wxwidgets.org/trunk/classw ... 99d299451b

2) Put it into a wxScrolledWindow
Use the source, Luke!

runeight
Earned a small fee
Earned a small fee
Posts: 22
Joined: Sat Apr 11, 2020 5:53 pm

Re: Two Panel GUI ... ongoing

Post by runeight » Sat Apr 25, 2020 1:59 pm

I may need a little more help with #2.

In wxFB the current hierarchy is Frame -> Sizer -> staticText(with VSCROLL). This is the one that doesn't work.

I tried this Frame -> Sizer -> ScrolledWindow -> StaticText.

FB will not allow me to create this hierarchy. It enforces that ScrolledWindow and StaticText be peers under Sizer. So, what I'm doing here is wrong in that I can't put statictext inside scrolled window.

I've also tried Frame (with VSCROLL) -> Sizer -> StaticText(no VSCROLL). This doesn't work either.

How should I arrange the stack of widgets?

Thanks.

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

Re: Two Panel GUI ... ongoing

Post by doublemax » Sat Apr 25, 2020 3:45 pm

Why do you have a sizer anyway? A sizer that contains only one item usually doesn't make sense.

What kind of information (and how much as you need to scroll) do you display in the popup?

wxRichTooltip does not work for you?
https://docs.wxwidgets.org/trunk/classw ... l_tip.html

I would try:

Code: Select all

Frame -> ScrolledWindow -> StaticText
Use the source, Luke!

runeight
Earned a small fee
Earned a small fee
Posts: 22
Joined: Sat Apr 11, 2020 5:53 pm

Re: Two Panel GUI ... ongoing

Post by runeight » Sat Apr 25, 2020 6:27 pm

I have a sizer because....

wxFB won't allow me to put a statictext or a scollwindow directly into a frame. It gives the attached message where it is requiring a sizer first. No changes that I can make in wxFB AUI settings for the frame will allow me to drop either of these into the frame. The only way is to drop in a sizer first. Is FB unnecessarily constraining?
wx.PNG
wx.PNG (19.12 KiB) Viewed 470 times
I am putting a lot of text into these windows. They are entire documents with thousands of words. Most of the document, for nearly all of them, will be below the fold. It doesn't seem, at first glance, that a tool tip is the right thing. Is it?

In my current version the statictext does a perfect job of displaying the next for read only.

With my current, incomplete understanding, of all the finesse in wxW, it seemed like a full frame that looks like just like any other window with a title bar is the vehicle for what I need here. Admittedly, I am still pretty new.

I remember that you work mostly in VS. Can you think of any reason by wxFB will not let me create the hierarchy with a scrollwindow in the stack?

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

Re: Two Panel GUI ... ongoing

Post by doublemax » Sat Apr 25, 2020 7:11 pm

With sizers it should work, too. Try:

Code: Select all

Frame -> Sizer -> ScrolledWindow -> Sizer -> StaticText.
Make sure you set "proportion" to 1 and set wxEXPAND flag in each case.

Another alternative could be a multiline wxTextCtrl in read-only mode. Then you would just have:

Code: Select all

Frame -> Sizer -> wxTextCtrl
Use the source, Luke!

runeight
Earned a small fee
Earned a small fee
Posts: 22
Joined: Sat Apr 11, 2020 5:53 pm

Re: Two Panel GUI ... ongoing

Post by runeight » Sat Apr 25, 2020 7:52 pm

Great. Thx. The first one works. However.....

In the original stack the statictext did word wrapping automatically to the width and responded to resize.

Now, it does not wrap at all. If I set the wrap to a fixed value, it still doesn't wrap. How do I correct this?

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

Re: Two Panel GUI ... ongoing

Post by doublemax » Sat Apr 25, 2020 10:45 pm

Hmm, yeah. Because the wxStaticText is now in a wxScrolledWindow, it can become as wide as it wants :)

Try setting a max width for the static text.
Use the source, Luke!

runeight
Earned a small fee
Earned a small fee
Posts: 22
Joined: Sat Apr 11, 2020 5:53 pm

Re: Two Panel GUI ... ongoing

Post by runeight » Sat Apr 25, 2020 11:21 pm

Tried this. What happens is that statictext width is fixed but scrollwindow is not. So I can stretch the window to the right and a blank area appears beyond the text. I then set the max width of the scroll window. Big enough so that I can see. Then I increased the max size of the frame.

What I get when I stretch this setup to the right is attached. This is the right edges of all the elements. There also seems to be an attempt to draw another scroll bar even though that option is not selected for statictext.
wx.PNG
wx.PNG (43.74 KiB) Viewed 439 times
Is there a way to tell the parent objects not to exceed the "width" of statictext? For both of them, while accounting for the space of borders and scroll bars???

If not, is there a way to get the scroll bars that can be attached directly to static text to work? They are part of the widget when it displays, they just don't scroll. And the wrapping was perfect for the static widget alone. :)

Thanks.

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

Re: Two Panel GUI ... ongoing

Post by doublemax » Sun Apr 26, 2020 12:06 am

Post some compilable code i can play around with.

What about the wxTextCtrl route?
Use the source, Luke!

runeight
Earned a small fee
Earned a small fee
Posts: 22
Joined: Sat Apr 11, 2020 5:53 pm

Re: Two Panel GUI ... ongoing

Post by runeight » Sun Apr 26, 2020 12:28 am

OK. I can do that.

I recall looking at textctrl and deciding on the current implementation. I'll look again before send you some code. :)

runeight
Earned a small fee
Earned a small fee
Posts: 22
Joined: Sat Apr 11, 2020 5:53 pm

Re: Two Panel GUI ... ongoing

Post by runeight » Sun Apr 26, 2020 1:46 am

You were right about textctrl and I don't remember why I didn't use it except that I was still too new to wxW to make a good choice.

But, this works perfectly. Thanks once again for your help.

Post Reply