About Monkey 2 › Forums › Monkey 2 Programming Help › Hiding a Window view
This topic contains 4 replies, has 3 voices, and was last updated by 
 nerobot 1 year, 4 months ago.
- 
		AuthorPosts
 - 
		
			
				
December 13, 2017 at 9:50 am #12258
I’m trying to hide a Window view.
It starts out hidden using ‘WindowFlags.Hidden’ and I’m using ‘myWindow.Visible=True’ to show it.
But when I try to hide it with ‘myWindow.Visible=False’ I get the debug message “Windows cannot be deactivated”
It’s not my main window, I have a separate window that is always open.Mistake, or am I doing something wrong?
Also, is there a way to make a “tool” window?
December 13, 2017 at 8:37 pm #12267Monkey2 only currently supports a single window. Multiple windows may or may not work to varying degrees depending on target – they are totally untested. By all means feel free to get in there and try to get them working – the basic framework is there – but I wont be able to address this myself for a while yet.
December 14, 2017 at 6:40 pm #12287Ah okay, I hadn’t even thought about it working on other targets…
I’ve been poking about, trying to figure it out myself, atleast on desktop targets since that’s all I need.
But I’m not quite getting the results I want.Here’s a simple example if anyone’s interested:
Monkey12345678910111213141516171819202122232425262728293031323334353637#Import "<std>"#Import "<mojo>"Using std..Using mojo..Class BigWindow Extends WindowMethod New()Super.New("Big Window", 640, 480)EndEndClass SmallWindow Extends WindowMethod New()Super.New("Small Window (Close Me)", 320, 240, WindowFlags.Hidden)Local appearTimer:Timer=New Timer(1, Lambda()Self.Visible=TrueEnd)EndMethod OnWindowEvent( event:WindowEvent ) OverrideSelect event.TypeCase EventType.WindowCloseSelf.Visible=FalseEndEndEndFunction Main()New AppInstanceNew BigWindowNew SmallWindowApp.Run()EndWait for the small window to appear, then try to close it (which should just hide it)
Hidden windows do work if they’re created with ‘WindowFlags.Hidden’, but showing them and then hiding them manually causes the error “Windows cannot be deactivated”December 14, 2017 at 8:46 pm #12288sdl2.SDL_HideWindow( Self.SDLWindow ) and sdl2.SDL_ShowWindow( Self.SDLWindow ) seems to do the trick.
Things get a bit weird at places, and you may need to redraw the window when shown… but overall it works.December 15, 2017 at 4:46 am #12297And… we can use real windows for showing dialogs, and for hints to be able to go beyond the boundaries of main window.
 - 
		AuthorPosts
 
You must be logged in to reply to this topic.