SP2 - My App does not show main form

N

Neville Lang

Hi all,

Yesterday, I upgraded the .NET CF to SP2 on the PPC. Today has been the
first chance to run a Deploy and a Debug session on the device (PPC WM2003)
from VS .NET 2003.

After deploying, I noticed that when my app starts I get the usual wait
cursor then, after a time, the wait cursor disappears and all I see is the
Today screen again. I have found that my app has started but I now need to
tap on Start then tap on my app again in order to see the main form, in
other words, bring it to front.

Under SP1, this did not happen. When the wait cursor disappeared the main
form displayed. The problem only began with SP2.

I use a timed splash form that starts when the main form's Load event
occurs. I tried adding BringToFront() to both the splash form and to the
main form but the problem still persists. Any ideas?


Regards,
Neville Lang
 
G

Ginny Caughey [MVP]

Neville,

I created a splash screen as a separate app that I invoke (using
CreateProcess) from Main before I instantiate the main form. The spash
screen has a timer instantiated in the Load event handler for the splash
screen that calls the spash's Close method after some seconds. This works
fine for me using CE 4.1 but I haven't tested in on PPC 2003 yet. Maybe this
approach would work for you too?
 
N

Neville Lang

Ginny,

Thank you for your suggestion. I suspected the problem may not be in the
splash screen but with my App and SP2. I removed all traces of the splash
screen code and deployed the app onto my iPAQ 3970 with WM2003 but still the
same problem.

When I start my app, the wait cursor displays and when that has finished,
the Today screen displays again though it does now show the icon for the SIP
(the little Pen symbol plus the Up arrow). This indicates to me that my app
has started and I now need to tap on Start then on my App in the menu again
in order to view the main form.

Why is this action different to the RTM and SP1 versions of .NET CF? This
has only begun in SP2. What is it about SP2 that changes the load pattern
of my apps main form? How can I get the main form to display at startup
under SP2?

I have tried the calling BringToFront() in the main form's load event method
with no success since I knew that SP2 added the z-order functionality.

Any further ideas would be appreciated.

Regards,
Neville
 
C

Chris Tacke, eMVP

Try a Refresh or an Activate after BringToFront. Sounds like it just needs
to paint itself.

-Chris
 
N

Neville Lang

Chris,

I added the BringToFront() and Refresh() to the main form's Load event
handler and still no change to the problem.

Previously, I had not been using the Activated event on main form so I
implemented that event and mapped it an event handler where I called
BringToFront() and Refresh(). I still have the same problem.

Something in SP2 seems to be causing my app not to be brought to the front
on the initial startup. I had no problems with SP1.

Regards,
Neville Lang
 
F

Franky

It's look like if the Form_load() run like a passthrout application with out
stop for event....



____________________
Franky
(e-mail address removed)
 
M

Mark Ihimoyan [MSFT]

could you please attach a sample code to attempt to reproduce this problem.
 
N

Neville Lang

Mark,

Thanks. I will create a sample and send it to you soon.

Regards,
Neville Lang
 
N

Neville Lang

Mark,

I have found the problem why my main form does not show at startup. It seems
something has changed in Application:DoEvents() under SP2.

Briefly, in my main form's constructor, the last thing I do in the
constructor is to call a method of mine to enable/disable some menu items
after some testing, as follows:

MAIN FORM CONSTRUCTOR
....
....
....
// Update menu item status
this.DoSomeChecking();


MAIN FORM METHOD
public void DoSomeChecking()
{
if (this.lsbListBox.Items.Count > 0)
{
this.miEdit.Enabled = true; // Menu item
this.miCpyEdit.Enabled = true; // Menu item
this.savebutton.Visible = true;
// Check for Data Origin. If external then do not allow Edit of this
object.
if (this.myobject.byOrigin.ToString() == "0") // True if created by
this app.
{
this.miEdit.Enabled = true;
}
else if (this.myobject.byOrigin.ToString() == "1") // True if
imported from external app.
{
this.miEdit.Enabled = false;
}
}
else
{
this.miEdit.Enabled = false;
this.miCpyEdit.Enabled = false;
this.savebutton.Visible = false;
}
this.lsbListBox.Visible = true;
Application.DoEvents(); // Now update the screen following these
changes
}

This method is also called by other event handlers as well at various places
in my code.

I added the line "Application.DoEvents();" some months ago after finding
that items were not being updated for viewing by the user. The addition of
this line fixed the problems at that time.

It now seems that under SP2, when I remove this line, the main form now
appears at startup, as I require.

For your testing, create a new SmartDeviceApplication Project and call it
Test (or any other name) and in the constructor, just add the line
"Application.DoEvents();" after the TODO: notes. If you also set the Default
Device to the actual PPC that has .NET CF SP2 (I did not test it on the
emulator) then press the F5 function key to begin Debug, you will see that
the main form does not display on the PPC device. Under SP1 and RTM version
of .NET CF all was OK but now under SP2 there is a problem when
"Application.DoEvents();" is run in the main form's constructor.

This might be one for the currect bug list. I'd be interested on any
feedback you have on this.

All I have now done in my code was to take out the call to
"Application.DoEvents();" and everything now seems fine, even the display
problems I had several months ago. But I will need to re-check and confirm
this again.


Regards,
Neville Lang
 
M

Mark Ihimoyan [MSFT]

Did you reconfirm this?
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top