blitz-foundation / monkey2

zlib License
3 stars 0 forks source link

Import MojoX before Mojo is different from vice-versa #34

Open Pharmhaus-2 opened 5 years ago

Pharmhaus-2 commented 5 years ago

Original Author: DoctorWhoof

In the code below, try swapping the lines that import mojox and mojo. The little separator that allows you to drag the scroll view side to side will not show up.

Not sure if a bug or just a side effect from how the import system works, but it definitely took me a while to catch...

#Import "<mojo>"
#Import "<mojox>" '<------- Try Importing mojox BEFORE mojo, and the ScrollView won't resize like it should

Using std..
Using mojo..
Using mojox..

Function Main()
    New AppInstance
    New TestWindow
    App.Run()
End

Class TestWindow Extends Window
    Public
    Method New()                    
        Super.New( "Test", 800, 600, WindowFlags.Resizable )
        Local dock := New GameDock
        ContentView = dock
    End
End

Class GameDock Extends DockingView
    Method New()
        Local toolbar := New ToolBar( Axis.X )
        toolbar.Style = Self.Style.Copy()
        toolbar.Style.BackgroundColor = Color.Grey
        toolbar.MinSize = New Vec2i( 200,32 )
        AddView( toolbar, "top", "32", False  )

        Local scroll := New ScrollView
        scroll.Style = Self.Style.Copy()
        scroll.Style.BackgroundColor = Color.Grey
        AddView( scroll, "right", "400", True  )

        Style.BackgroundColor = Color.DarkGrey
    End
End