Simple way to create a scrollable panel?

Discussion in 'Questions (Windows Mobile)' started by corwin42, Jan 2, 2009.

  1. corwin42

    corwin42 Expert Licensed User

    Hello,

    is there a simple way to create a scrollable panel?

    The idea is to create a settings panel with a few label and textbox controls. When the user enables the SIP the panel should resize to the space left on the form and a scrollbar should appear so that the user can scroll down to the lower controls.

    Any chance to do this? You can see this in many PPC applications (The ASUS Wi-Fi Manager can do it for example).

    Greetings,
    Markus
     
  2. willisgt

    willisgt Active Member Licensed User

    I haven't actually written anything like this, but yes, it should be possible.

    To start, you'll need to create a background panel.

    Create a foreground panel and a scrollbar. Both should be created so the background panel is the parent, not the form. The width of the background panel should be enough to fit the foreground panel and scrollbar.

    Write a sub to allow the scrollbar to reposition the foreground panel up and down ( panelForeground.Top = 0 - scrollbar1.Value ).

    Write a routine to catch SIP panel opening and closing. You'll need the Hardware library for this. Resize the background panel and scrollbar, but leave the foreground panel height alone.

    I'll see if I can whip up an example program real quick.


    Gary
     
  3. willisgt

    willisgt Active Member Licensed User

    I think this is what you're talking about.
     

    Attached Files:

  4. corwin42

    corwin42 Expert Licensed User

    Thank you very much.

    This is exactly what I was searching for.

    Greetings,
    Markus
     
  5. corwin42

    corwin42 Expert Licensed User

    Hi!

    I played around with this topic a bit more and found a much easier way with using the door.library and setting the AutoScale, Dock and Anchor properties of the controls.

    Play around with the supplied simple example on the device. Switch SIP on and off and rotate the screen. The controls are moved and scaled correct automatically.

    If you want to see this method in a real life application just look at my PDA TileManager


    You can rotate the screen and switch on and off the SIP and you always have full access to all controls. The only limitation is that it needs .Net CF 2.0 or above.

    It works really great.

    Markus
     

    Attached Files:

  6. SonicSue

    SonicSue Member Licensed User

    I have been searching for just this solution you posted to address screen orientation problems when users pull out the keyboard on their device. My app wasn't rotating and remaining functional, but thanks to your 'rearrange' post, it is! Thanks! :sign0060:
     
  7. jroriz

    jroriz Active Member Licensed User

    sbp file

    What is this sbp file?
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    sbp file is the main source file of Basic4ppc projects (similar to Basic4android b4a files).
     
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