Discussion in 'Questions (Windows Mobile)' started by yildi, Nov 16, 2007.

  1. yildi

    yildi Member Licensed User

    I am thinking about the landscape and portrait mode handling in the same Basic4PPC program. I am asking myself if I must write different forms, one for each format, doing the same thing and show one or the other as a function of the orientation of the screen, to be able to better use the screen space.

    This is not necessarily the most intelligent way of handling things (since I have to handle the fact that controls doing the same thing will have different names in different orientations.

    Do you any idea for better handling this problem (which should be met by all of you)? One would need form generated events like HeightChanged (width, height) and WidthChanged (width, height) to be able to detect the change of the orientation. I do not think that these events do exist. Is there an intelligent way of simulating them? I know that FormLIb library does contain a detection event but I would not like to add a library just for this function since I am trying not to use any external library and develop my program on the base of a unique executable file. I would like to create a small and slick proggie. Basic4PPC sh/c/ould handle this, no?

    Any advice on this issue?

    Best regards,

  2. colin9876

    colin9876 Active Member Licensed User

    Bonjour - Good Question,
    Im a newbie here but just one obvious thought is if u put all the buttons etc in the first 240x240 of the screen - it wont matter which orientation u have it will still show properly! Hows that for a simple idea?

    I would also like to know how to detect which way the screen is orientated?
  3. Erel

    Erel Administrator Staff Member Licensed User

    You would have to use FormLib library.
    Without adding a FormLib object, the form will not redraw itself after a screen orientation change.
    After adding FormLib you will also be able to use the Resize event, and in this event you can change the controls layout based on the current form size.

    Why don't you want to use external libraries?
    Using SetupBuilder you can pack all the files and create a single setup file:
  4. yildi

    yildi Member Licensed User

    Thanks to both of you.

    Dear Colin,
    I do already use this trick but in this case you have worst ob both worlds (between landscape and portrait, in terms of screen estate) and this is not very optimal.

    Dear Erel,
    I really want to have a very small and simple program, very easy to install for others (I can use setup builder, thanks your instructions). In a way, since this is my first program with basic4ppc; I would like to use it as best as I can, without calling other libraries to rescue.
    For example, I have remarked that if I put all my controls in a panel, the panel automatically switches when the screen orientation changes and I can do the following :
    Panel1.Width = Max(TRPPC.Height,TRPPC.Width)
    where TRPPC is a form.

    And the panel is resized in order to cover the whole screen without messing the placement of my controls but, of course, their size is not changed. I am thinking now a way for automatizing the location and the size (the latter for some controls that are strategic, like tables to browse or textfields that show some dynamic information) of these controls as a function of the dimensions of the form. I think this is doable.

    If I find a satisfactory solution, I will come back and tell it here but I was hoping that someone else has already found the trick, since this is very common problem.

    Best regards,

  5. Erel

    Erel Administrator Staff Member Licensed User

    Again, the best solution is to use FormLib and the Resize event.
    Another solution will be to use a timer to periodically check the screen size and change the layout if required.
  6. yildi

    yildi Member Licensed User

    Thanks Erel,

    I think I can even live with just a Refresh menu that can handle this resizing manually (yes, I know that I can be quite stubborn ;-) but I really like parcimonous programs).

    My main problem is now to find an intelligent way of changing the size of some controls as a function of the screen orientation.

    Best regards,

  7. yildi

    yildi Member Licensed User

    Dear Erel,

    EDIT: Problem solved (see below)

    Since the FormLib library is really ridiculously small, I have decided to follow your suggestion and include this library. I am now trying to create a setup file using setup builder. I can create a cab file but when I click on the button "Built setup file", I get a DOS screen about ezsetup with a PAUSE and when I push any key, it continues and closes the screen but I cannot find the TRPPCSetup.exe file in the SetupBuilder folder (or in my application folder). I do not get any error message either. Any idea?
    Last edited: Nov 20, 2007
  8. Erel

    Erel Administrator Staff Member Licensed User

    What happens when you press on 'Build Cabs's?
    Does it create the cab files?
  9. yildi

    yildi Member Licensed User

    I am really sorry Erel,

    I have already solved this problem. Normally, I have tried to edit my post yesterday night and to tell it to you but I have probably done something stupid during the edit process.

    Yes, my error was very stupid: I was not using the correct ezsetup. I do noy know why, the ezsteup which is on my computer is not the one to which you are pointing from the web site. I have downloaded the SBP version and everything works now.

    Sorry again for taking your time for such a stupid problem.

    Best regards,