About Monkey 2 › Forums › Monkey 2 Programming Help › Help with GUI
This topic contains 3 replies, has 2 voices, and was last updated by 
 Hezkore
 2 years, 1 month ago.
- 
		AuthorPosts
 - 
		
			
				
February 17, 2017 at 11:13 pm #7190
I can’t for the life of me figure out how to make a DockingView at the left side of the screen (say 50% or so) with a TextView at the top, a few checkboxes under it and a button at the bottom.
The TextView never fully covers the entire area, it just sits as a tiny bar at the top.Monkey12345678910111213141516171819202122232425262728293031323334#Import "<std>"#Import "<mojo>"#Import "<mojox>"Using std..Using mojo..Using mojox..Class MyWindow Extends WindowMethod New()Super.New("Simple Mojo Gui App",640,480,WindowFlags.Resizable)Local mainview:=New DockingViewLocal d1:DockingView=New DockingViewLocal d2:DockingView=New DockingViewd1.AddView(New TextView(),"top")d2.AddView(New PushButton("Activate"),"top")d1.Layout="fill"mainview.AddView(d1,"left","128",True)d1.AddView(d2,"bottom")ContentView=mainviewEndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndUPDATE: Okay so I think I’ve got it figured out…
Monkey123456789101112131415161718192021222324252627282930#Import "<std>"#Import "<mojo>"#Import "<mojox>"Using std..Using mojo..Using mojox..Class MyWindow Extends WindowMethod New()Super.New("Simple Mojo Gui App",640,480,WindowFlags.Resizable)Local mainview:=New DockingViewLocal d1:DockingView=New DockingViewd1.ContentView=New TextView()d1.AddView(New PushButton("Activate"),"bottom")d1.AddView(New CheckButton("Option"),"bottom")mainview.AddView(d1,"left","128",True)Self.ContentView=mainviewEndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndFebruary 19, 2017 at 1:24 am #7197Another question regarding the GUI…
How would I get the width of a DockingView that is resizable?
The draggable knob, or whatever, never seems to be taken into account when testing for width.Also, how do detect if a mouse click is inside my DockingView or the main window canvas?
And is there any way to get images from the theme?
I know there’s App.Theme.OpenImage but that only loads an image from the theme folder, I want to specify a image name in the theme json file and somehow get that in the app.Finally, is there a way to remove spaces at the start of a word-wrapped line in the TextView?
Cause, this:
 isn’t very pretty.
The space before “to” should be removed.February 20, 2017 at 1:50 am #72201. Width – you can catch onLayout processing by extending mojox view. But when I tried to do that I got endless onLayout queue…
2. Mouse click – look at OnMouseEvent (or OnContentMouseEvent) but need to extend mojox view to use this way.
3. Have no on the box. Hm, maybe we can write theme extension class to get that stuff.
4. Remove spaces – small fix in textview needed. Maybe I’ll create patch..
February 24, 2017 at 3:05 am #7268I’ve managed to get images from a theme using “skins”.
They’re automatically loaded once the theme is applied.Monkey1myImage=App.Theme.GetStyle("YourStyle").Skin.ImageIn the theme file you’ll have to add something like:
Monkey1"YourStyle":{"skin":"some_image.png"},Don’t forget that it needs to go under “styles”:{ in the theme file and the image has to be in the “themes” folder!
 - 
		AuthorPosts
 
You must be logged in to reply to this topic.