ShowDialog ApplicationEx OpenNetCF

  • Thread starter Nathan Franklin
  • Start date
N

Nathan Franklin

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...

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:%[email protected]...
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.

Nathan Franklin said:
Paul

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

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:[email protected]...
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

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


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message 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

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



"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
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 visisble? maybe some sort of repaint?? im not sure

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


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
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....

is this the cause of my problem??

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
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

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
 
N

Nathan Franklin

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
in its UI at times, and if the toolbar is not a child of the Form, that
might explain a few things.

-Chris




Nathan Franklin said:
yes it is opennetcf 2.0 beta.. is this not good?

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:[email protected]...
And, therefore, OpenNETCF 2.0 beta?

Paul T.

visual studio 2005 cf 2

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message 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

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


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
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

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



"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
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 visisble? maybe some sort of repaint?? im
not sure

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


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
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....

is this the cause of my problem??

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument
no spam DOT com> wrote in message
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

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
 
G

Guest

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


Nathan Franklin said:
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
in its UI at times, and if the toolbar is not a child of the Form, that
might explain a few things.

-Chris




Nathan Franklin said:
yes it is opennetcf 2.0 beta.. is this not good?

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message And, therefore, OpenNETCF 2.0 beta?

Paul T.

visual studio 2005 cf 2

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message
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

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


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
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

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



"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
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 visisble? maybe some sort of repaint?? im
not sure

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


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument
no spam DOT com> wrote in message
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....

is this the cause of my problem??

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument
no spam DOT com> wrote in message
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

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
 
N

Nathan Franklin

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
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


Nathan Franklin said:
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 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?

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message And, therefore, OpenNETCF 2.0 beta?

Paul T.

visual studio 2005 cf 2

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
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

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


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
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

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



"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
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 visisble? maybe some sort of
repaint?? im not sure

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


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument
no spam DOT com> wrote in message
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....

is this the cause of my problem??

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no
instrument no spam DOT com> wrote in message
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

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
 
G

Guest

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



Nathan Franklin said:
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 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


Nathan Franklin said:
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

"<ctacke/>" <ctacke_AT_OpenNETCF_com> wrote in message
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?

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message
And, therefore, OpenNETCF 2.0 beta?

Paul T.

visual studio 2005 cf 2

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
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

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


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
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

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



"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument
no spam DOT com> wrote in message
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 visisble? maybe some sort of
repaint?? im not sure

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


"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument
no spam DOT com> wrote in message
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....

is this the cause of my problem??

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no
instrument no spam DOT com> wrote in message
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

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
 

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