Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / April 2006

Tip: Looking for answers? Try searching our database.

ShowDialog ApplicationEx OpenNetCF

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nathan Franklin - 03 Apr 2006 13:45 GMT
Dear List,

I am having a few problems with the ShowDialog method of the Application2
(ApplicationEx) class of the OpenNetCF package.

When I call the ShowDialog Method, everything works good except for the
toolbar on the new form. Its kinda like the toolbar is disabled. I can click
on the SIP and bring it up but when i try and click on the toolbar nothing
happens. It doesnt respond to any events or anything like that.

Here is a copy of my code

First of all in modMain to start the app
HardKeyWatcherHandler.NavFilter = New OpenNETCF.Windows.Forms.NavFilter

Application2.AddMessageFilter(HardKeyWatcherHandler.NavFilter)

Application2.Run(New frmMain)

Then to open the new form

Dim frmSearch As frmReportSearch

frmSearch = New frmReportSearch

dr = Application2.ShowDialog(frmSearch, False)

Any help would be appreciated.. thanks

Nathan
Nathan Franklin - 03 Apr 2006 13:57 GMT
I should mention I am using Windows CE 5 SDK with PPC2003

> Dear List,
>
[quoted text clipped - 26 lines]
>
> Nathan
Paul G. Tobey [eMVP] - 03 Apr 2006 16:07 GMT
Huh?  You're using a Windows CE 5 SDK but with a device running Windows CE
4.2?  Why wouldn't you use the PPC2003 SDK to develop for that device?

Paul T.

>I should mention I am using Windows CE 5 SDK with PPC2003
>
[quoted text clipped - 28 lines]
>>
>> Nathan
Nathan Franklin - 03 Apr 2006 22:03 GMT
the CE 5 sdk has alot of extra stuff not included in the ppc2003 sdk...
everything has worked fine up until this....

is this the cause of my problem??

> Huh?  You're using a Windows CE 5 SDK but with a device running Windows CE
> 4.2?  Why wouldn't you use the PPC2003 SDK to develop for that device?
[quoted text clipped - 33 lines]
>>>
>>> Nathan
Paul G. Tobey [eMVP] - 03 Apr 2006 22:16 GMT
The SDK does *not* control what is supported on the device.  The device OEM
and, maybe, extra items added to the device later do that.  Anything that is
only in the WM5 SDK and not in the 2003 SDK should *not* be assumed to be
present!

It's at least somewhat likely that counting on things to be present which
are not or counting on things to work one way when they don't is
responsible.  Try the correct SDK and see what you get.

Paul T.

> the CE 5 sdk has alot of extra stuff not included in the ppc2003 sdk...
> everything has worked fine up until this....
[quoted text clipped - 39 lines]
>>>>
>>>> Nathan
Nathan Franklin - 03 Apr 2006 22:49 GMT
using the correct sdk had no effect.

im at a loss as to what to do??

please help

> The SDK does *not* control what is supported on the device.  The device
> OEM and, maybe, extra items added to the device later do that.  Anything
[quoted text clipped - 52 lines]
>>>>>
>>>>> Nathan
Nathan Franklin - 03 Apr 2006 22:51 GMT
another thing you may wish to know is when the second form loads up I have a
label at the top of the form which seems to only appear when the SIP is
visisble? maybe some sort of repaint?? im not sure

as soon as push the sip button to hide it the label disappears again

> The SDK does *not* control what is supported on the device.  The device
> OEM and, maybe, extra items added to the device later do that.  Anything
[quoted text clipped - 52 lines]
>>>>>
>>>>> Nathan
Paul G. Tobey [eMVP] - 03 Apr 2006 22:59 GMT
I suspect that you're going to have to build the smallest possible example
that shows the problem and post the source...

Paul T.

> another thing you may wish to know is when the second form loads up I have
> a label at the top of the form which seems to only appear when the SIP is
[quoted text clipped - 58 lines]
>>>>>>
>>>>>> Nathan
Nathan Franklin - 03 Apr 2006 23:13 GMT
Paul

Thanks for your reply

Code in modMain (gets called to start off the program)
HardKeyWatcherHandler.NavFilter = New OpenNETCF.Windows.Forms.NavFilter

Application2.AddMessageFilter(HardKeyWatcherHandler.NavFilter)

Application2.Run(New frmMain)

frmMain.Dispose()

frmMain = Nothing

In frmMain this code is the code that handles loading up the new form

Dim dr As DialogResult

Dim frmSearch As frmReportSearch

frmSearch = New frmReportSearch

Cursor.Current = Cursors.Default

dr = Application2.ShowDialog(frmSearch)

Cursor.Current = Cursors.WaitCursor

ReportID = frmSearch.ReportID

frmSearch.Dispose()

frmSearch = Nothing

Another thing that I have found out is that if i run (as the main startup
form) frmReportSearch with Application2.Run the form works with no problems,
its only after I call it with ShowDialog that the problems start...

Do you need any more code? Im not sure if you do, but just let me know

thanks again

Nathan

>I suspect that you're going to have to build the smallest possible example
>that shows the problem and post the source...
[quoted text clipped - 63 lines]
>>>>>>>
>>>>>>> Nathan
Paul G. Tobey [eMVP] - 03 Apr 2006 23:18 GMT
You'd want to actually try to build a new project from scratch, so that you
can send *all* of the code.  Copy and paste is just going to create more
failure points.

Paul T.

> Paul
>
[quoted text clipped - 109 lines]
>>>>>>>>
>>>>>>>> Nathan
Nathan Franklin - 03 Apr 2006 23:39 GMT
Paul

I have built a new project and reproduces the error here is a copy of all my
code

Please note that on form2 the toolbarbuttonclick sub never gets fired...

thanks so much for taking the time to look at this!

nathan

module1.vb
Imports OpenNETCF.Windows.Forms

Imports Microsoft.WindowsCE.Forms

Module Module1

Public NavFilter As OpenNETCF.Windows.Forms.NavFilter

Sub Main()

NavFilter = New OpenNETCF.Windows.Forms.NavFilter

Application2.AddMessageFilter(NavFilter)

Application2.Run(New Form1)

If Not NavFilter Is Nothing Then

Application2.RemoveMessageFilter(NavFilter)

NavFilter = Nothing

End If

End Sub

End Module

form1.vb

Imports OpenNETCF.Windows.Forms

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim f As Form2

f = New Form2

Application2.ShowDialog(f, False)

f.Dispose()

f = Nothing

End Sub

Public Sub New()

' This call is required by the Windows Form Designer.

InitializeComponent()

' Add any initialization after the InitializeComponent() call.

End Sub

End Class

Form2.vb

Public Class Form2

Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) Handles
ToolBar1.ButtonClick

MsgBox("here")

End Sub

End Class

NavFilter.vb

Imports OpenNETCF.Windows.Forms

Imports Microsoft.WindowsCE.Forms

Namespace OpenNETCF.Windows.Forms

Public Enum WinMsg As Integer

WM_CLOSE = &H10

WM_PAINT = &HF

WM_KEYDOWN = &H100

WM_KEYUP = &H101

End Enum

Public Delegate Sub KeyEvent(ByRef hwnd As Integer, ByRef e As KeyEventArgs)

' this class handles all the nav keydown events

' there is a global variable ActivePanel which we look at when we navigate
around our form

' if any controls are not on the active panel we wont navigate to them

' if a control is out of view we set the scrolling position so the control
is in view...

Public Class NavFilter

Implements IMessageFilter

Private mHwnds As ArrayList

Public Event KeyDown As KeyEvent

Sub New()

mHwnds = New ArrayList

End Sub

Public Property Hwnds() As ArrayList

Get

Return mHwnds

End Get

Set(ByVal value As ArrayList)

mHwnds = value

End Set

End Property

Public Function PreFilterMessage(ByRef m As
Microsoft.WindowsCE.Forms.Message) As Boolean Implements
IMessageFilter.PreFilterMessage

If mHwnds.Contains(m.HWnd.ToInt32) Then

If m.Msg = WinMsg.WM_KEYDOWN Then

Dim keyArgs As New KeyEventArgs(m.WParam.ToInt32)

If keyArgs.KeyValue = Keys.Up Or keyArgs.KeyValue = Keys.Down Or
keyArgs.KeyValue = Keys.Left Or keyArgs.KeyValue = Keys.Right Then

' this is where we need to process our nav...

' we raise the event because we will hanbdle everything else in ModMain

' this just keeps things clean in here

RaiseEvent KeyDown(m.HWnd.ToInt32, keyArgs)

' only handle this if we can.. else this will be sent through the normal
processing system

If keyArgs.Handled Then

Return True

End If

End If

End If

End If

Return False

End Function

End Class

End Namespace

> You'd want to actually try to build a new project from scratch, so that
> you can send *all* of the code.  Copy and paste is just going to create
[quoted text clipped - 115 lines]
>>>>>>>>>
>>>>>>>>> Nathan
Paul G. Tobey [eMVP] - 03 Apr 2006 23:50 GMT
What version of .NET CF are you targeting?  I don't see the information in
your previous messages and I don't recognize anything as absolutely being 1
or 2...

Paul T.

> Paul
>
[quoted text clipped - 309 lines]
>>>>>>>>>>
>>>>>>>>>> Nathan
Nathan Franklin - 03 Apr 2006 23:56 GMT
visual studio 2005 cf 2

> What version of .NET CF are you targeting?  I don't see the information in
> your previous messages and I don't recognize anything as absolutely being
[quoted text clipped - 315 lines]
>>>>>>>>>>>
>>>>>>>>>>> Nathan
Paul G. Tobey [eMVP] - 04 Apr 2006 00:03 GMT
And, therefore, OpenNETCF 2.0 beta?

Paul T.

> visual studio 2005 cf 2
>
[quoted text clipped - 318 lines]
>>>>>>>>>>>>
>>>>>>>>>>>> Nathan
Nathan Franklin - 04 Apr 2006 00:07 GMT
yes it is opennetcf 2.0 beta.. is this not good?

> And, therefore, OpenNETCF 2.0 beta?
>
[quoted text clipped - 326 lines]
>>>>>>>>>>>>>
>>>>>>>>>>>>> Nathan
<ctacke/> - 04 Apr 2006 00:21 GMT
The beta should be fine.  Have you verified with Remote Spy++ that the
toolbar is in fact a child of the Form?  Pocket PC is a little unorthodox in
its UI at times, and if the toolbar is not a child of the Form, that might
explain a few things.

-Chris

> yes it is opennetcf 2.0 beta.. is this not good?
>
[quoted text clipped - 331 lines]
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Nathan
Nathan Franklin - 04 Apr 2006 00:30 GMT
Chris,

It appears that the toolbar is not child to the form. this does explain, but
how can I fix it? I have absolutly no idea!

thanks mate

nathan

> The beta should be fine.  Have you verified with Remote Spy++ that the
> toolbar is in fact a child of the Form?  Pocket PC is a little unorthodox
[quoted text clipped - 339 lines]
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Nathan
<ctacke/> - 04 Apr 2006 00:58 GMT
Yes, it explains a bit.  Is the Toolbar even in the same process? I know it
sounds like a strange question, but take the "Form Caption" for example in
Pocket PC.  It's actually not the caption of the form - it's a separate
process that allows for the notification icons, etc.

-Chris

> Chris,
>
[quoted text clipped - 349 lines]
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Nathan
Nathan Franklin - 04 Apr 2006 01:19 GMT
The toolbar displays as top lvl.

here is what remote spy says

"<No Name>" (menu_worker)
   - "<No Name>" (ToolbarWindow32)

it doesnt come under the Form1 Or Form2 or the app exe name and that is the
process cause I matched the hwnd's up to it

> Yes, it explains a bit.  Is the Toolbar even in the same process? I know
> it sounds like a strange question, but take the "Form Caption" for example
[quoted text clipped - 357 lines]
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Nathan
<ctacke/> - 04 Apr 2006 05:43 GMT
That explains why you don't get its messages directly.  Next you have to
reverse engineer how it's communicating with your app.  Ah the joys of the
mobile platform....

-Chris

> The toolbar displays as top lvl.
>
[quoted text clipped - 367 lines]
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Nathan
Paul G. Tobey [eMVP] - 04 Apr 2006 00:00 GMT
Still some items missing there, too, I think.  InitializeComponent?  Just
ZIP up the whole project and post it.  It won't come through to those using
the Web interface, but I'll get it fine.

Paul T.

> Paul
>
[quoted text clipped - 309 lines]
>>>>>>>>>>
>>>>>>>>>> Nathan
Nathan Franklin - 04 Apr 2006 00:05 GMT
Paul

could you please email me your email address off list as this list does not
allow binary content...

> Still some items missing there, too, I think.  InitializeComponent?  Just
> ZIP up the whole project and post it.  It won't come through to those
[quoted text clipped - 315 lines]
>>>>>>>>>>>
>>>>>>>>>>> Nathan
Paul G. Tobey [eMVP] - 04 Apr 2006 00:18 GMT
You should be able to post binary attachments to the list with no problem,
if you're using a regular NNTP reader.  If you're using the Web interface at
microsoft.com, you can't.  If you look at the return address on my message
and remove "space" "no spam" "no" and "no spam", you'll get the address.

Paul T.

> Paul
>
[quoted text clipped - 321 lines]
>>>>>>>>>>>>
>>>>>>>>>>>> Nathan
Nathan Franklin - 04 Apr 2006 00:24 GMT
ok paul i have sent you a copy through...

when it ried to email it to the list outlook express errored and said binary
not allowed on a non-binary list...

> You should be able to post binary attachments to the list with no problem,
> if you're using a regular NNTP reader.  If you're using the Web interface
[quoted text clipped - 333 lines]
>>>>>>>>>>>>>
>>>>>>>>>>>>> Nathan
Nathan Franklin - 03 Apr 2006 23:01 GMT
i have done some more digging and found that a mainmenu control using the
correct sdk doesnt work either...
could it be something to do witht he message pump??

> another thing you may wish to know is when the second form loads up I have
> a label at the top of the form which seems to only appear when the SIP is
[quoted text clipped - 58 lines]
>>>>>>
>>>>>> Nathan
Nathan Franklin - 04 Apr 2006 03:09 GMT
any ideas at all  guys??

> Dear List,
>
[quoted text clipped - 26 lines]
>
> Nathan

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.