Mac OS X - Canvas doesn't redraw after RequestFile
Monkey Targets Forums/Desktop/Mac OS X - Canvas doesn't redraw after RequestFile
| ||
Seems like something is blocking the canvas from redrawing after you called RequestFile. I could reproduce it with the sample below. Click to open the file dialog. After that, the canvas is "dead". Mac OS X GlfW Target Import mojo2 Import brl.requesters Class MyApp Extends App Field canvas:Canvas Field txt: String = "Hello World" Method OnCreate() canvas=New Canvas End Method OnUpdate() If MouseHit(MOUSE_LEFT) Then Local filter:="Image Files:png,jpg,bmp;Text Files:txt;All Files:*" Local file:=RequestFile( "Select graphic file to open",filter ) If file txt = file End End Method OnRender() canvas.Clear 0,0,1 canvas.SetBlendMode 3 canvas.SetColor 0,0,0,.5 canvas.DrawText txt,DeviceWidth/2+2,DeviceHeight/2+2,.5,.5 canvas.SetBlendMode 1 canvas.SetColor 1,1,0,1 canvas.DrawText txt,DeviceWidth/2,DeviceHeight/2,.5,.5 canvas.SetColor(1,0,0) canvas.DrawRect(MouseX, MouseY, 32, 32) canvas.Flush End End Function Main() New MyApp End |
| ||
You can solve this (and I think it may be only solution) by calling SetUpdateRate in OnCreate. |
| ||
My program already sets the update rate on create but it doesn't work. It doesn't help in the sample program, too. |
| ||
Apologies Ratchet, I didn't test before posting. I have now on Sierra with Monkey-X 85e and your code works as is without the problem you describe. |
| ||
I'm using 86e on Yosemite. |
| ||
I will upgrade and report back. |
| ||
Tested with 87a (built from source after unsuccessful attempt installing 86e) and also works without issue so I suspect this is a Yosemite specific issue. |
| ||
I tested it on Snow Leopard. There I got another behavior: I can't close the file dialog no matter if I click Open, Cancel or press Escape. |
| ||
Unfortunately I don't have access to any legacy Macs. If you run from console you may be able to capture some output that helps fix this issue. %appname%.app/Contents/MacOS/%appname% Having a quick look at the source, it might be worth trying the following mod to comment out a questionable API call in modules/brl/native/requester.cpp[190] static void beginPanel(){ keyWin=[NSApp keyWindow]; // if( !keyWin ) [NSApp activateIgnoringOtherApps:YES]; } Another test would be to try triggering the requester from a key press and not a mouse down or key down event (to avoid having the requester open before the up event is properly handled by the app). |
| ||
Commenting the line does the job on Yosemite. I didn't test it on Snow Leopard because I don't need it there. |
| ||
The problem on Snow Leopard is still the same: I can't close the file dialog no matter if I click Open, Cancel or press Escape. And now I need this on Snow Leopard after all. And Mark isn't responding to my bug report I've send to him. |
| ||
Weird: On Yosemite I got the same behavior like on Snow Leopard now. I can't close the file dialog no matter if I click Open, Cancel or press Escape. I don't know what's different now. |
| ||
You may want to try running your app from command line in case the OS is emitting any helpful warnings. |
| ||
The command line says nothing :( |