Screen looses focus

Dec 14, 2009 at 1:56 PM
Edited Dec 15, 2009 at 8:23 AM

Hello,

 

First of all I like to congratulate you on your serious effort.

Now, I'm having some issues with a sample application (stripped from the demo app) when I'm leaving the app out of focus, do other stuff on the emulator and finally I'm entering the app again, the screen remains blue untill I click around (more exactly when I click a item from the menu)

 

private Silvermoon.Core.Screen m_Screen;
private StartMenu m_MainMenu;

public TestForm()
{
	InitializeComponent();

	m_Screen = Silvermoon.Core.Screen.Initialize(this);

	m_Screen.Renderer.BackgroundColor = Color.White;
	m_Screen.Renderer.Perspective = true;

	m_MainMenu = new StartMenu();
	m_MainMenu.Show();

	this.GotFocus += new EventHandler(Window_GotFocus);
}

void Window_GotFocus(object sender, EventArgs e)
{
	m_Screen.Window.Update();
	m_Screen.Window.Refresh();
}

I've also tried out this.GotFocus += new EventHandler(MainWindow_GotFocus); with this.Update() and/or this.Refresh() inside MainWindow_GotFocus(object sender, EventArgs e)

Can someon please help out. This is verry annoying and I would verry much like to solve this issue.

 

Dec 15, 2009 at 7:35 AM
Edited Dec 15, 2009 at 11:52 AM

 

this.GotFocus += new EventHandler(Window_GotFocus);

void Window_GotFocus(object sender, EventArgs e)
{
	m_Screen.Window.Update();
	m_Screen.Window.Refresh();

	m_Screen.Renderer.Render(m_MainMenu.Controls);
	m_MainMenu.Focus();
}

I've managed to solve the issue (for now) by using the above code. Is there a better way to do this?

LE: Now, when my test app gets focus the screen refreshes, all the controls appear, but on the bottom bar of the screen I can see the keyboard item (that originally wasn't there) and it will remain there untill I click it.. I believe is the same issue as here: http://silvermoon.codeplex.com/Thread/View.aspx?ThreadId=71716

LE2: It appears that the vizual glitch (the keyboard icon in the middle of the bottom bar) doesnt appear on my x650 glofish (no opengl support), the screen refresh works ok and the GotFocus event using the above method works also (still I'm not sure if it is the right way to do it)

LE3: Using this:

 

this.GotFocus += new EventHandler(Window_GotFocus);
this.LostFocus += new EventHandler(FormConvert_LostFocus);

void FormConvert_LostFocus(object sender, EventArgs e)
{
	m_MainMenu.Invalidate(Silvermoon.Controls.InvalidationFlag.All);
}

void Window_GotFocus(object sender, EventArgs e)
{
	//m_Screen.Window.Refresh();
	//m_Screen.Window.Update();
	//m_Screen.Renderer.Render(m_MainMenu.Controls);

	m_MainMenu.Focus();
}

I've managed to get it to work again, but on my device, when I click the start button, the start drop down menu appears over my test app, wich messes up the design, and when the focus is back on the test app, the design remains messed up. Thats only on my device and only when I click the start button. In rest everything works perfect.