Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

help with code

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-29-2008, 05:05 PM
Junior Member
 
Join Date: Dec 2008
Location: Legazpi City, PH
Posts: 11
Send a message via MSN to twisted Send a message via Yahoo to twisted
Awards Showcase
Beta Tester 
Total Awards: 1
Default help with code

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.
Reply With Quote
  #2 (permalink)  
Old 12-29-2008, 05:59 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

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.
Reply With Quote
  #3 (permalink)  
Old 01-03-2009, 09:42 AM
Junior Member
 
Join Date: Dec 2008
Location: Legazpi City, PH
Posts: 11
Send a message via MSN to twisted Send a message via Yahoo to twisted
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by Erel View Post
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.
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
Reply With Quote
  #4 (permalink)  
Old 01-03-2009, 01:31 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

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
File Type: sbp SystemStateDemo.sbp (735 Bytes, 22 views)
Reply With Quote
  #5 (permalink)  
Old 01-03-2009, 04:56 PM
Junior Member
 
Join Date: Dec 2008
Location: Legazpi City, PH
Posts: 11
Send a message via MSN to twisted Send a message via Yahoo to twisted
Awards Showcase
Beta Tester 
Total Awards: 1
Wink

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.
Reply With Quote
  #6 (permalink)  
Old 01-03-2009, 05:29 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Exactly, except of the first line: lansdcape.show.
Reply With Quote
  #7 (permalink)  
Old 01-04-2009, 05:02 PM
Junior Member
 
Join Date: Dec 2008
Location: Legazpi City, PH
Posts: 11
Send a message via MSN to twisted Send a message via Yahoo to twisted
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by Erel View Post
Exactly, except of the first line: lansdcape.show.
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.
Reply With Quote
  #8 (permalink)  
Old 01-04-2009, 05:36 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

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.
Reply With Quote
  #9 (permalink)  
Old 01-06-2009, 08:48 AM
Junior Member
 
Join Date: Dec 2008
Location: Legazpi City, PH
Posts: 11
Send a message via MSN to twisted Send a message via Yahoo to twisted
Awards Showcase
Beta Tester 
Total Awards: 1
Cool

Quote:
Originally Posted by Erel View Post
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.
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
File Type: sbp RUN.SBP (903 Bytes, 11 views)
Reply With Quote
  #10 (permalink)  
Old 01-07-2009, 06:26 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

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
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
code just... stops! Offbeatmammal Questions (Windows Mobile) 4 06-02-2008 07:30 PM
Add Code giannimaione Questions (Windows Mobile) 5 06-01-2008 06:03 PM
reg code question scott93727 Questions (Windows Mobile) 2 05-30-2008 12:24 PM
Help with code cdeane Questions (Windows Mobile) 9 09-22-2007 04:30 PM
Code files jerryjukem Questions (Windows Mobile) 1 07-28-2007 06:57 PM


All times are GMT. The time now is 03:34 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0