help with code

Discussion in 'Questions (Windows Mobile)' started by twisted, Dec 29, 2008.

  1. twisted

    twisted Member Licensed User

    :sign0104:is there a way to run my app during slideout of keyboard and minimize it when slide-in of keyboard?
    can you help me with the code? i'm a noob at coding and stuff.
    thanks in advance.

    btw. i'm using a ppc with slide-out keyboard.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    It is possible to catch the display orientation change event with agraham's SystemState library.
    You will need to set an event for 'DisplayRotation' property.
     
  3. twisted

    twisted Member Licensed User

    hi,
    how or what is the code to create/set an event for display rotation property?
    i don't know how to code this, i have not done any coding.
    thanks for the help.

    regards,
    mike
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Try this code (file is attached):
    Code:
    Sub Globals

    End Sub

    Sub App_Start
        Form1.Show
        flb.New1(
    "form1",B4PObject(1))
        SysState.New1(
    "DisplayRotation")
    End Sub

    Sub SysState_StateChanged 'This code will be fired when the orientation will chage.
        form1.Show
        textbox1.Text = SysState.CurrentValue 
    'will return 90 or 0 depending or the orientation.
    End Sub

    Sub Menu1_Click
        AppClose
    End Sub
    You will need to download the SystemState library.
     

    Attached Files:

  5. twisted

    twisted Member Licensed User

    thanks for the reply but i dont know how to implement the code into my app.
    what i want to do is to run my app during slide out of keyboard and run in background when slide in of keyboard.

    Code:
    Sub App_Start

       flb.New1(
    "landscape",B4PObject(1))
       sysstate.New1(
    "DisplayRotation")
    End Sub

    Sub SysState_StateChange

       landscape.Show 
    'landscape is the name of the form
       If (SysState.CurrentValue=270Then landscape.Show 'run the form when landscape mode
       If (SysState.CurrentValue=0Then hardware.ShowTodayScreen 'run my app in background
    End Sub
    is it possible with the code above?
    thanks again.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Exactly, except of the first line: lansdcape.show.
     
  7. twisted

    twisted Member Licensed User

    hi there again,
    i can't seem to get it working, i have attached the source code of my app, can you take a look if you have time. thanks very much.
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Please try to change the sub to:
    Code:
    Sub SysState_StateChange
        
    If SysState.CurrentValue=0 Then hardware.ShowTodayScreen
        
    If SysState.CurrentValue=270 OR sysstate.currentValye = 90 Then Landscape.Show
    End Sub
    BTW, you should only upload source code and other image files. No need to upload dlls.
     
  9. twisted

    twisted Member Licensed User

    hi there again,
    i still can't get it to work, so i made a new app (say app1) to run another app (say app2). that way i can get it to work when i slide my keyboard out and i made an event for app1 to kill the process of app2 when i slide the keyboard in.

    the problem is when i slide the keyboard out again it takes a while to load/open app2.

    is there a way to run and minimize or hide app2 by running app1 so that when i slide the keyboard in & out it will load fast? is there a way to combine the two apps? and is there a way to lessen the memory consumption of the apps?
    thanks again and sorry for all the trouble.
    attached are the source codes

    regards,
    mike
     

    Attached Files:

    • RUN.SBP
      File size:
      903 bytes
      Views:
      36
  10. Erel

    Erel Administrator Staff Member Licensed User

    Apparently the system changed event is not accurate enough.
    Another solution would be to use a timer to test its value:
    Code:
    Sub Globals
        lastOrientation = -
    1
    End Sub

    Sub App_Start
        Form1.Show
        flb.New1(
    "form1",B4PObject(1))
        SysState.New1(
    "DisplayRotation")
        hardware.New1
        textbox1.Text = sysstate.CurrentValue
        Timer1.Interval = 
    100
        Timer1.Enabled = 
    True
    End Sub

    Sub Timer1_Tick
        newOrientation = SysState.CurrentValue
        
    If newOrientation = lastOrientation Then Return
        
        
    If newOrientation = 0 Then hardware.ShowTodayScreen
        
    If SysState.CurrentValue=270 OR SysState.CurrentValue=90 Then form1.Show
        lastOrientation = newOrientation
    End Sub
     
  11. twisted

    twisted Member Licensed User

    still not working for me, anyway thanks for the help, maybe i need to do some research & study some programming language first before i make some app, hehe.

    regards,
    mike

    p.s.
    is there a way to hide application1 by running application2? thanks.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice