Adding two views to one view

About Monkey 2 Forums Monkey 2 Programming Help Adding two views to one view

This topic contains 8 replies, has 4 voices, and was last updated by  Hezkore 2 years ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #7832

    Hezkore
    Participant

    I’m trying to make my own “view” (they’ll forever be called gadgets to me heh)
    Basically, I want one main view, which does nothing more than house two other views in a DockingView you can resize.

    I can’t figure out how to do it though!
    I’ve tried AddChildView but it never produces any result, it’s like it’s never added.
    Something similar to this:

    Here’s a picture of what I want:

    Main view, view 1 and view 2 would just be one single view to the end user.
    When you make a new view, you’d just do blah=New MainView, and view 1 and 2 would always be part of it.

    Any examples of this?

    #7836

    nerobot
    Participant

    Look at this example

    Inside of MainView you can see two different ways of AddView – one with percentage, other with pixels.

    If you use percentage – views will resizable according to parent view.

    If you use pixels – resizing beam became visible, so we can change it position.

    #7840

    Hezkore
    Participant

    Super big thanks!

    I’m having a super hard time understanding how “Views” work…
    MaxGUI made sense to me, MojoX does not haha.

    With a bit of messing around, I finally managed to get it to act the way I want!

    #7851

    nerobot
    Participant

    AFAIK, AdamStrange made his own layout system, but I didn’t look at that.

    I like QT widgets, maxgui is like qt. But i don’t remember is it possible to use auto-stretching gadgets in maxgui.

    The power of ui system based on flexible layout system. Let’s bring it into mx2 official repo at one point? 🙂   mojo[y]

    #7852

    AdamStrange
    Participant

    Yep, I made my own one, Mojox just doesn’t work.

    Ted21 uses this new layout system for the custom controls as wells as mt font editor, map editor, sprite editor, and palette editor.

    Check them out here:

    https://adamstrange.itch.io

    Both the font and palette editor have no mojox anywhere near them – apart from the internal stuff that Mark moved into Mojo.

    In essence I took the Mojo view and started from scratch from their building a proper flexible control and layout system.

    #7859

    Mark Sibly
    Keymaster

    Mojox just doesn’t work.

    Works fine here.

    Mojox could definitely do with more layout views, like GridView, FlowView etc. These’ll happen one day, but DockingView is a very flexible alternative for now.

    Wish I could spend more time on mojox, but it’s still relatively low priority…

    #7860

    Hezkore
    Participant

    Yeah, it’s not that MojoX doesn’t work for me.
    It’s just kinda confusing, especially without any proper documentation or examples.
    MojoX doesn’t come naturally to me, like MaxGUI did.
    I mean, I’ll probably learn it eventually, but it’s hard figuring everything on my own.

    #7861

    Mark Sibly
    Keymaster

    It’s just kinda confusing, especially without any proper documentation or examples.

    There’s a sample for each view type in the mojox/tests dir, but yeah, docs could be better.

    Mojox is a little more complex than MaxGUI as it aims for an algorithmic layout approach instead of using ‘hard coded’ coords/sizes everywhere ala MaxGUI. This is mainly to make it easier to write GUIs that work on a wide range of devices/resolutions, but it also helps when dealing with resizable windows and dynamic themes.

    Alas, there is not a great deal of variety when it comes to layout style views. It really needs something like a GridView for arranging simple tool palettes etc, a FlowView for quick ‘n’ nasty ‘add some buttons to a windows’ functionality, and likely a bunch more! DockingView is flexible, but it can be cumbersome to use in some situations.

    I’ll probably be getting back into some mojox soon, but in the meantime, here’s a little GridView that might be useful for situations such as the above:

     

    …that was pretty fun to write – think I’ll add this to mojox right now!

    #7862

    Hezkore
    Participant

    Whoa!
    You’re a machine Mark haha.

    Thanks a bunch, but focus on the 3D module! (Or ZIP module)
    The 3D module is the only reason I check Twitter every day heh. x)

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.