Page 1 of 1

Two Panel GUI ... ongoing

Posted: Sat Apr 25, 2020 1:06 am
by runeight
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.

Re: Two Panel GUI ... ongoing

Posted: Sat Apr 25, 2020 8:33 am
by doublemax
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

Re: Two Panel GUI ... ongoing

Posted: Sat Apr 25, 2020 1:59 pm
by runeight
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.

Re: Two Panel GUI ... ongoing

Posted: Sat Apr 25, 2020 3:45 pm
by doublemax
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

Re: Two Panel GUI ... ongoing

Posted: Sat Apr 25, 2020 6:27 pm
by runeight
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 488 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?

Re: Two Panel GUI ... ongoing

Posted: Sat Apr 25, 2020 7:11 pm
by doublemax
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

Re: Two Panel GUI ... ongoing

Posted: Sat Apr 25, 2020 7:52 pm
by runeight
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?

Re: Two Panel GUI ... ongoing

Posted: Sat Apr 25, 2020 10:45 pm
by doublemax
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.

Re: Two Panel GUI ... ongoing

Posted: Sat Apr 25, 2020 11:21 pm
by runeight
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 457 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.

Re: Two Panel GUI ... ongoing

Posted: Sun Apr 26, 2020 12:06 am
by doublemax
Post some compilable code i can play around with.

What about the wxTextCtrl route?

Re: Two Panel GUI ... ongoing

Posted: Sun Apr 26, 2020 12:28 am
by runeight
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. :)

Re: Two Panel GUI ... ongoing

Posted: Sun Apr 26, 2020 1:46 am
by runeight
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.