Screen orientation changes automatically?

Discussion in 'Questions (Windows Mobile)' started by mwaite, Apr 30, 2007.

  1. mwaite

    mwaite Member Licensed User

    I see reference to screen orientation support in the "What's New" doc, however I cannot find any way to detect a screen orientation event has occurred. Am I to assume we must query the height/width ourselves?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You need to use the FormLib library.
    Code:
    [LEFT][FONT=Courier New][COLOR=#008000]'First add an object named flb of type FormLib.[/COLOR][/FONT]
    [
    FONT=Courier New][COLOR=#0000ff]Sub [/COLOR][/FONT][FONT=Courier New][COLOR=#010101]Globals[/COLOR][/FONT][/LEFT]
     
     
    [LEFT][
    FONT=Courier New][COLOR=#0000ff]End Sub[/COLOR][/FONT][/LEFT]
     
     
    [LEFT][
    FONT=Courier New][COLOR=#0000ff]Sub [/COLOR][/FONT][FONT=Courier New][COLOR=#010101]App_Start[/COLOR][/FONT]
    [
    FONT=Courier New][COLOR=#010101]     Form1.show[/COLOR][/FONT]
    [
    FONT=Courier New][COLOR=#010101]     flb.New1("Form1",[/COLOR][/FONT][FONT=Courier New][COLOR=#0000ff]B4PObject[/COLOR][/FONT][FONT=Courier New][COLOR=#010101](1))[/COLOR][/FONT]
    [
    FONT=Courier New][COLOR=#0000ff]End Sub[/COLOR][/FONT][/LEFT]
     
     
    [LEFT][
    FONT=Courier New][COLOR=#0000ff]Sub [/COLOR][/FONT][FONT=Courier New][COLOR=#010101]flb_Resize [/COLOR][/FONT][FONT=Courier New][COLOR=#008000]'Fires when the user changes the screen orientation[/COLOR][/FONT]
    [
    FONT=Courier New][COLOR=#0000ff]if [/COLOR][/FONT][FONT=Courier New][COLOR=#010101]Form1.Width > Form1.Height [/COLOR][/FONT][FONT=Courier New][COLOR=#0000ff]then[/COLOR][/FONT]
    [
    FONT=Courier New][COLOR=#0000ff]msgbox[/COLOR][/FONT][FONT=Courier New][COLOR=#010101]("Landscape")[/COLOR][/FONT]
    [
    FONT=Courier New][COLOR=#0000ff]else[/COLOR][/FONT]
    [
    FONT=Courier New][COLOR=#0000ff]msgbox[/COLOR][/FONT][FONT=Courier New][COLOR=#010101]("Portrait")[/COLOR][/FONT]
    [
    FONT=Courier New][COLOR=#0000ff]end if[/COLOR][/FONT]
    [
    FONT=Courier New][COLOR=#0000ff]End Sub[/COLOR][/FONT][/LEFT]
     
  3. mwaite

    mwaite Member Licensed User

    Thanks Erel.

    I thought I had seen that somewhere when I was reading the docs, but when I went looking for it again I couldn't find it in the list of methods that Formlib supports, and search "resize" yields nothing. I see it now in the Overview paragraph. By chance is there a complete list of supported events/methods for the librarys that one can use as a reference? I hate to miss something. Now I can go remove my timer event that was looking for screen orientation changed ;)
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    It is missing from the FormLib help by mistake.
    It will be fixed. :signOops:
     
Loading...