Results 1 to 11 of 11

Thread: PPC Navigation Bar Help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    30

    PPC Navigation Bar Help

    Hi hope some one can help,

    I'm struggling to work out how i can trap when the 'x' on the ppc nav bar is tapped so i can close any open forms in my prog.

    Or if anyone can suggest other ways i can do this.

    the problem i'm having is that if a user presses the 'x' on the nav bar my active forms aren't closed and stay in memory.

    Thanks in advance

  2. #2
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: PPC Navigation Bar Help

    do you want to close the entire application when the user hits x on any forms button
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    30

    Re: PPC Navigation Bar Help

    Sure that would work for me.

    Just to be clear thought, it isn't the 'x' on the form like in windows its on the nav bar, a circle with an x in it.

    thnxs for the reply.

  4. #4
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: PPC Navigation Bar Help

    each form is on its own thead so when you close one form the rest stay open..

    what you need to do is have a controller class that you declare the forms in and create the instances, this class needs to be passed into each forms contructor... and from this controller class you have methods that you call to show the form you want and then have a method exit app which closes and disposes all forms and exits the thread...

    ill post a sample if u need..
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    30

    Re: PPC Navigation Bar Help

    the sample sounds good, thnxs.

    I understand about each form needing to be closed seperatley etc but the main thing i'm struggling to understand is how to test for the event to close all the froums

  6. #6
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: PPC Navigation Bar Help

    this class needs to be called from the sub main in your code (recommend to place this in another class called main)

    VB Code:
    1. 'controller class
    2.  
    3. public class mainctrl
    4.  
    5. private m_frm1 As Form1
    6. private m_frm2 As Form2
    7.  
    8. public sub new()
    9. End sub
    10.  
    11. public sub initialise()
    12.  
    13. m_frm1 = New Form1
    14. m_frm1.Hide()
    15.  
    16. m_frm2 = New form2
    17. m_frm2.Hide()
    18.  
    19. ShowForm1(nothing)
    20.  
    21. end sub
    22.  
    23. Public Sub ShowForm1(ByVal p_closingform As Form)
    24. m_frm1.Show()
    25. If Not p_closingform Is Nothing Then
    26.    P_closingform.hide()
    27. End If
    28. End Sub
    29.  
    30. Public Sub ShowForm2(ByVal p_closingform As Form)
    31. m_frm1.Show()
    32. P_closingform.hide()
    33. End Sub
    34.  
    35. Public Sub ExitApp()
    36. m_frm1.dispose
    37. m_frm2.dispose
    38. application.exit()
    39. End Sub
    40.  
    41. End Class
    42.  
    43.  
    44. 'Form1
    45.  
    46.    Private m_mainCtrl As mainCtrl
    47.  
    48.     Public Sub New(ByVal p_mainCtrl)
    49.         Me.New()
    50.         m_mainCtrl = p_mainCtrl
    51.     End Sub
    52.  
    53. Public Sub btnShowForm2_Click() (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSurveys.Click
    54. m_mainctrl.ShowForm2(me)
    55. End Sub
    56.  
    57. Public Sub btnExit_Click() (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSurveys.Click
    58. m_mainctrl.exitApp
    59. End Sub
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    30

    Re: PPC Navigation Bar Help

    Thanks for the sample, I will give it a try soon

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    30

    Re: PPC Navigation Bar Help

    Hi Strider,

    Have tried your code but i'm having a few problems.
    • I'm new at all this.
      I'm using visual studio 2k5 and seem to be having problems with the sub main part. I dont know how to make it?


    Hoping you can help again

  9. #9
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: PPC Navigation Bar Help

    i have no idea what VS2005 is like but in VS2003 you needed to have a sub main in the application. Generally you specified this in Project -> <ProjectName> Properties on the Main menu. In the general properties there was a startup object where you specifed a form or sub main where the project will launch from.

    Public Class Main
    Public Shared Sub Main()
    Application.Run(New Form1)
    End Sub
    End Class
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    30

    Re: PPC Navigation Bar Help

    Ahhhh thought some of your code looked 2k3. Unfortunately vs2k5 is totally different
    from my limited exposure. This is one of the reasons it is so confussing to a newbie when try to self teach. Lots of examples of how to do things but most aren't for vs2k5 or PPC and they are just slightly different to give errors, hehe.

    YOu do however still have the startup object and you can still specify form or sub main.

    I just need to work out how to call it to utiliz your code example

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    30

    Re: PPC Navigation Bar Help

    @Strider,

    I have had time try your code and as usual with VB2k5 and PPC things didnt go quite to plan but it dawned on me that your example rely's on a button on the form "btnExit" to be clicked to call "ExitApp()".

    The problem i'm having is the button being tapped on the PPC is on the navigation bar, a system button and not on the form i have created.

    This is the button event i'm trying to check for.

    Have i understood your code correctly do you have any suggestions?

    Hears hoping

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width