Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TBTextField formatting #70

Open
lighth7015 opened this issue May 23, 2016 · 13 comments
Open

Support TBTextField formatting #70

lighth7015 opened this issue May 23, 2016 · 13 comments

Comments

@lighth7015
Copy link

Hi,

While playing with the turbobadger demo application, I noticed that TBTextField doesn't appear to support formatting (font sizes, etc.). Perhaps I'm just doing it wrong(tm)?

Thanks!

@fruxo
Copy link
Owner

fruxo commented Jun 4, 2016

That's correct. It makes single line items extra fast. But since it's possible to mix widgets any way you want, you can just put a TBEditField inside something else if you require formatting.

The demo does this for a button like this:

    TBButton
        TBEditField: gravity: all, skin: 0, multiline: 1, readonly: 1, adapt-to-content: 1, styling: 1
            text: "A <color #0794f8>TBButton</color> with styled text that is able to wrap to multiple lines."

@lighth7015
Copy link
Author

But I just tried putting a TBEditField inside a TBTextField, and the content doesn't appear, what gives?

@lighth7015
Copy link
Author

lighth7015 commented Jun 4, 2016

This is what I'm doing with the demo-

WindowInfo
    title TBToggleContainer
TBLayout: axis: y
    TBTextField
        TBEditField: gravity: all, adapt-to-content: 1, multiline: 1, readonly: 1, skin: 0, virtual-width: 400
            text: "TBToggleContainer used with TBWidgetValue connections to automatically toggle a group of items (no programming needed)."

    TBLayout: position: top left
        TBContainer
            TBLayout: axis: y
                TBClickLabel: text: "Check to enable stuff:"
                    TBCheckBox: connection: toggle_demo_1

                # == Toggle enabled =====================================================
                TBToggleContainer: connection: toggle_demo_1, toggle: enabled
                    TBLayout: axis: y
                        TBClickLabel: text: "Option 1"
                            TBRadioButton: group-id: group1, value: 1
                        TBClickLabel: text: "Option 2"
                            TBRadioButton: group-id: group1

                TBClickLabel: text: "Check to disable stuff:"
                    TBCheckBox: connection: toggle_demo_2

                # == Toggle enabled, with the invert flag set ===========================
                TBToggleContainer: connection: toggle_demo_2, toggle: enabled, invert: 1
                    TBLayout: axis: y
                        TBClickLabel: text: "Option 1"
                            TBRadioButton: group-id: group2, value: 1
                        TBClickLabel: text: "Option 2"
                            TBRadioButton: group-id: group2

        TBContainer
            TBLayout: axis: y
                TBClickLabel: text: "Check to show stuff:"
                    TBCheckBox: connection: toggle_demo_3

                # == Toggle opacity =====================================================
                TBToggleContainer: connection: toggle_demo_3, toggle: opacity
                    TBLayout: axis: y
                        TBClickLabel: text: "Option 1"
                            TBRadioButton: group-id: group3, value: 1
                        TBClickLabel: text: "Option 2"
                            TBRadioButton: group-id: group3

                TBClickLabel: text: "Check to expand stuff:"
                    TBCheckBox: connection: toggle_demo_4

                # == Toggle expand ======================================================
                TBToggleContainer: connection: toggle_demo_4, toggle: expanded
                    TBLayout: axis: y
                        TBClickLabel: text: "Option 1"
                            TBRadioButton: group-id: group4, value: 1
                        TBClickLabel: text: "Option 2"
                            TBRadioButton: group-id: group4

@lighth7015
Copy link
Author

Also, is there a way I could attach a menubar to the "top" of the client area, sort of like an MDI window?

@fruxo
Copy link
Owner

fruxo commented Jun 4, 2016

TBTextField is pretty eager to resize to its own text size (See TBTextField::OnCalculatePreferredContentSize) which is why you don't see the containing widget, or other widgets (issue #71). There's very little point in putting the TBEditField inside TBTextField though. Both implement SetText, so just drop the TBTextField and use TBEditField directly.

A menubar at the top should work fine i think. I haven't tried though.

@fruxo
Copy link
Owner

fruxo commented Jun 4, 2016

I just remembered something i thought about a long time ago. I think the stuff inside the top of TBWindow should be put inside an TBLayout so it's a bit easier to inject extra buttons to windows, put TBEditFields there or whatever. Is styled window title what you want to achieve?

@lighth7015
Copy link
Author

lighth7015 commented Jun 4, 2016

No, I'm trying to style TBTextFields with simple HTML-like tags (bold, italic, underline) for a network-enabled client that I'm working on with a colleague. We're going to send TB layout information to the client who then handles creating the window and laying it out.

@lighth7015
Copy link
Author

Also, the problem with using TBEditField is that we don't want users to be able to select and copy text in/out of the application, since you may be dealing with sensitive information (personal information, since this is a network client, after all.)

@fruxo
Copy link
Owner

fruxo commented Jun 4, 2016

Ok. TBTextField won't do it, and i don't think it should.
You can still use TBEditField. You can use "ignore-input" and "is-focusable" to disable interaction with it to prevent copy, selection etc.

@lighth7015
Copy link
Author

Okay, now for something a little more involved.. I've got a UI mockup (in Illustrator) that I'm roughly trying to translate to TB. I'm not asking for you to do it, I'm just not sure how it would be done.

intervuemockup-20150720

@lighth7015
Copy link
Author

And I was thinking about bundling python bytecode to provide some level of client-sude automation, would it be very difficult to bind python to the "forms"?

@lighth7015
Copy link
Author

Oh, by the way- we seem to be having issues compiling in FreeType support under Win32. Is there a trick to doing it?

@tesch1
Copy link

tesch1 commented Oct 4, 2016

seems like this issue is solved and can be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants