Announcement

Collapse
No announcement yet.

Scrollbar control

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scrollbar control

    Hi forum!

    I need advice how to make scrollbar control (prefferably in DDT).
    I need to make special format file viewer and scrollbar seems to be the best for scrolling it in window. I can't use textbox because of file size (in text form up to 10 megs). My idea is to read and show only part of file with displaying it's contents in separated text boxes (columns).

    Thanks in advance

    Cezary Zielinski

  • #2
    Cezary --
    Look http://www.powerbasic.com/files/pub/pbwin/petzold.zip

    Chapter 8, color1.bas

    ------------------

    Comment


    • #3
      On this subject, it's worth noting that there was an omission in the PB/DLL help file: CONTROL ADD SCROLLBAR.



      ------------------
      Lance
      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      Lance
      mailto:[email protected]

      Comment


      • #4
        "On this subject, it's worth noting that there was an omission in
        the PB/DLL help file: CONTROL ADD SCROLLBAR."

        Interesting. Is there an updated helpfile available somewhere, or
        a textfile with corrections for it?

        ------------------

        Comment


        • #5
          Not currently, sorry.


          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment


          • #6
            Thanks Semen, thanks everybody. I declared scroll bar in this manner:

            CONTROL ADD "scrollbar", hDlg, %ID_SCRL, "", x, y, xx, yy, _
            %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %SBS_VERT

            Events are handled like in Petzold's example.

            Thanks again

            Cezary

            ------------------

            Comment


            • #7
              Hi!

              I meet another problem with scrollbar. When I try to retrieve thumb position:

              Case %SB_THUMBPOSITION
              pos = GetScrollPos(sbCh, %SB_CTL)

              then I get previous position (before moving thumb).
              I can't use:

              pos = HIWRD(CBWPARAM)

              because it returns only 16 bit value.

              Any idea?

              ------------------

              Comment


              • #8
                Can DDT set a scrollbar (+ dialogScrollbar)?



                ------------------

                Comment


                • #9
                  Note The GetScrollPos function is provided for backward compatibility.
                  New applications should use the GetScrollInfo function.
                  The GetScrollInfo function enables applications to use 32-bit scroll positions.
                  Although the messages that indicate scroll-bar position,
                  WM_HSCROLL and WM_VSCROLL, provide only 16 bits of position data,
                  the functions SetScrollInfo and GetScrollInfo provide 32 bits of scroll-bar position data.
                  Thus, an application can call GetScrollInfo while processing
                  either the WM_HSCROLL or WM_VSCROLL messages to obtain 32-bit scroll-bar position data.
                  To get the 32-bit position of the scroll box (thumb) during a SB_THUMBTRACK
                  request code in a WM_HSCROLL or WM_VSCROLL message, call GetScrollInfo with the
                  SIF_TRACKPOS value in the fMask member of the SCROLLINFO structure.
                  The function returns the tracking position of the scroll box in the nTrackPos member
                  of the SCROLLINFO structure. This allows you to get the position of the scroll box
                  as the user moves it.
                  ------------------
                  Fred
                  mailto:[email protected][email protected]</A>
                  http://www.oxenby.se



                  [This message has been edited by Fred Oxenby (edited February 09, 2000).]
                  Fred
                  mailto:[email protected][email protected]</A>
                  http://www.oxenby.se

                  Comment


                  • #10
                    Thanks Fred!

                    I tried to read nPos, not nTrackPos - and it was mistake.

                    E B

                    I declared scroll bar control with:

                    CONTROL ADD SCROLLBAR, hDlg, %ID_SCRL, "", x, y, xx, yy, _
                    %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %SBS_VERT

                    and in callback function:

                    STATIC si AS SCROLLINFO

                    SELECT CASE CBMSG
                    CASE %WM_INITDIALOG
                    CONTROL HANDLE CBHNDL, %ID_SCRL TO sbch
                    si.cbSize = SIZEOF(si)
                    si.fMask = %SIF_ALL
                    si.nMin = pozP
                    si.nMax = pozK 'MAX(LOF(rf) - %Wys * DlRek, pozP)
                    si.nPage = %Wys * DlRek
                    si.nPos = pozP
                    SetScrollInfo sbch, %SB_CTL, si, %True
                    CASE %WM_VSCROLL
                    SELECT CASE CBCTL
                    CASE %SB_LINEUP
                    CASE %SB_LINEDOWN
                    .......

                    ------------

                    It is "alone" control, not associated with any textbox control.

                    Cezary

                    ------------------

                    Comment


                    • #11
                      Yes, but you used WINAPI with DDT.

                      My question was (for PB) if there where DDT-commands to set/maintain the scrollbar values..

                      Thanks,



                      ------------------

                      Comment


                      • #12
                        At this time you must use the appropriate scrollbar API calls, such as SetScrollInfo(), etc.

                        ------------------
                        Lance
                        PowerBASIC Support
                        mailto:[email protected][email protected]</A>
                        Lance
                        mailto:[email protected]

                        Comment

                        Working...
                        X