panel or form with scrollbar?

Discussion in 'Code Samples & Tips' started by tvrman, Sep 6, 2007.

  1. tvrman

    tvrman Member Licensed User


    I'm busy now for day's to find a way to make the form or an panel
    larger than the screen size, this can be easly done by choosing the
    screen size , but what happends with the form or panel which will
    be out of the screen size?, it seems it's still there but you can't
    reach it, so a scrollbar should be very usefull, so you don't have
    to create an amount of panels or form (on the exact size of the screen
    self i mean).
    Does there is an way to build an form or panel wich you can reach over
    the full length?, like putting an button on the right corner which contains
    next or more.. e.t..

    I'll hope there is some solution for this, because im writing some text
    on the screen which are more rows than the current form or panel can

  2. Erel

    Erel Administrator Staff Member Licensed User

    You should have asked earlier ;)
    You can use a ScrollBar and a panel to achieve it.
    [FONT=Courier New][SIZE=2][COLOR=#0000ff]Sub [/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]Globals
    FONT][FONT=Courier New][SIZE=2][COLOR=#008000]'Declare the global variables here.
    FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]End Sub
    FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]Sub [/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]App_Start
    FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"form2"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2],[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]220[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2],[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2],[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]20[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2],[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]270[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2],true)
     sb.Maximum = panel1.Height - form2.Height
    FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff] AddTextBox[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]([/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"panel1"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2],[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"txt1"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2],[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]10[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2],[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]400[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2],[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]100[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2],[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]25[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2],[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2])
    FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]End Sub
    Sub [/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]sb_ValueChanged
     panel1.Top = -sb.Value
    FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]End Sub
    The application and the ScrollBar library are also attached.

    Attached Files:

  3. tvrman

    tvrman Member Licensed User

    Hi Erel,

    Sjee why i didn't ask before this, im searching now for days at the forum,
    (im learning too on this).

    this is the solution for my project :sign0060:

    Let me say many thanks again! :sign0188:
  4. Cableguy

    Cableguy Expert Licensed User

    Also, the best place to ask is in the questions forum, not on the samples one....

    And of course, we all have learned a new bit with EREL's example...
  5. Erel

    Erel Administrator Staff Member Licensed User

    I moved this thread to the Code Samples as it is a good tip for a common problem.
  6. Cableguy

    Cableguy Expert Licensed User

    OK, Sorry, I didn't noticed it was a moved post...

    My appologies:signOops:
  7. cnicolapc

    cnicolapc Active Member Licensed User

    Panel GradientDrawable

    how can I set the via code the background colors Gradientdrawable of a panel?
    Thanks in advance
  8. klaus

    klaus Expert Licensed User

    I think that your question is for Basic4Android, so your post should be in the Android forum.
    If it is for Badic4PPC, Gradientdrawable doesn't exist. You should create a bitmap with the gadient colors and set it to the panel.

    Best regards.
  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