Announcement

Collapse
No announcement yet.

Scrollbar won't disappear

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

  • Scrollbar won't disappear

    I have a preview for xprint/graphc.
    I added a scrollbar (vertical) when i 'zoom' in.
    The 'zoomed' page show (in larger font) the top or bottom half of the page.
    I was using (and is still included) a button to 'page down/up'.

    The scrollbar works fine but i only want it to show up in the zoom mode.
    Now, if i just zoom and dont do a page down (or click on the scrollbar) then
    go back to full page display the scrollbar disappears as it should. But once
    i do a page/down or click the scrollbar then if i go back to full page view the
    scrollbar remains and i cant get rid of it. Here is the callback routine
    701 is the value of the scrollbar

    UPDATED CODE below -- the scrollbar now disappears thanks to the help of Fred Harris.
    Scrollbar now positions correctly.
    Removed the si.n whatever = 0 and
    setscrollinfo in the place where the scrollbar is eliminated and replaced with
    control kill.

    Code:
    CALLBACK FUNCTION DlgProc1
      LOCAL lResult&,x1!,x2!,y1!,y2!,fil$
      LOCAL msg$
      LOCAL si AS SCROLLINFO,oldpos AS LONG
    
      STATIC hCurZoom AS DWORD
      STATIC hCurZoomO AS DWORD
      STATIC hCursor1 AS DWORD
      STATIC hPreview AS DWORD
      STATIC GraphicHandle AS LONG
      STATIC cursorname AS ASCIIZ * 255
      STATIC cursorname2 AS ASCIIZ * 255
      STATIC modulename AS ASCIIZ * 255
      LOCAL nScreenWidth AS LONG,x&,xx&
      LOCAL nScreenHeight AS LONG,y&,yy&
      STATIC count&
      STATIC hCtrl&
      'cursorname="ZOOM"
      cursorname="ZOOMIN"
      cursorname2="ZOOMOUT"
      modulename="WUXPRNT.DLL"
      DIM rc AS RECT, i AS LONG, j AS LONG, Delta(1) AS LONG, ij AS INTEGER
      SELECT CASE CBMSG
        CASE %WM_INITDIALOG
           'hCurZoom  = LoadCursor(GetModuleHandle(""), "ZOOM")
           hCurZoom  = LoadCursor(GetModuleHandle(modulename), Cursorname) '"ZOOM")
           hCurZoomO  = LoadCursor(GetModuleHandle(modulename), Cursorname2) '"ZOOM")
          hPreview = GetDlgItem(hDlgPreview, %IDC_Graphic1) 'PREVIEW)
          hCursor1 = GetClassLong(hPreview, %GCL_HCURSOR)
          SetClassLong hPreview, %GCL_HCURSOR, hCurZoom 'Cursor2
          PageBeingViewed&=1
          PagesPreviewed&=1
    
          lResult&=previewit(coid$,pagesPreviewed&)
          CONTROL DISABLE hDlgPreview,%IDC_GRAPHIC1
        CASE %WM_MOUSEMOVE  ' Ensure zoom cursor is used
           IF GetCursor <> hCurZoom THEN
             IF zoom&=0 THEN
               SetCursor hCurZoom
             ELSE
               SetCursor hCurZoomO
             END IF
           END IF
        CASE %WM_DESTROY
          DestroyCursor hCursor1
          DestroyCursor hCurZoom
          DestroyCursor hCurZoomO
        CASE %WM_LBUTTONDOWN 'UP 'DOWN
              SendMessage hDlgPreview,%WM_COMMAND,304&,0
        CASE %WM_RBUTTONDOWN 'UP 'DOWN
            IF zoom&=1 THEN
              SendMessage hDlgPreview,%WM_COMMAND,304&,0
            END IF
        CASE %WM_VSCROLL
           count&=count&+1
            IF count&=2 THEN
              count&=0
              SendMessage hDlgPreview,%WM_COMMAND,305&,0 'access up/down
              EXIT FUNCTION
            ELSE
             EXIT FUNCTION
            END IF
        CASE %WM_COMMAND
          SELECT CASE CBCTL
            CASE %IDC_GRAPHIC1 'the graphic area (report)
              IF CBCTLMSG=%STN_CLICKED THEN
                SendMessage hDlgPreview,%WM_COMMAND,304&,0
              END IF
              IF CBCTLMSG=%STN_DBLCLK THEN
                IF zoom&=1 THEN SendMessage hDlgPreview,%WM_COMMAND,304&,0
              END IF
    
            CASE 301 'ok button end dialog and start print
              GRAPHIC WINDOW END  '???
              DIALOG END hDlgPreview,0
            CASE 302 'next page
              GRAPHIC SET POS (0,0)
              GRAPHIC CLEAR
              GRAPHIC REDRAW
              pagespreviewed&=pagespreviewed&+1
              'PageBeingViewed&=PageBeingViewed&+1
              IF pagespreviewed&>pagestoprint& THEN pagespreviewed&=pagestoprint&
              IF pagespreviewed&=pagestoprint& THEN
                CONTROL KILL hDlgPreview,302
                'CONTROL DISABLE hDlgPreview,302
                CONTROL ADD  BUTTON,hDlgPreview,302,"Next",   052,02,45,16
                CONTROL DISABLE hDlgPreview,302
              END IF
              IF pagespreviewed&>1 THEN
                CONTROL KILL hDlgPreview,303
                CONTROL ADD IMGBUTTONX, hDlgPreview,303,"PRV",   099,02,45,16 '097,2,45,16
                SLEEP 0
              END IF
              'IF PageBeingViewed&>pagestoprint& THEN PageBeingViewed&=pagestoprint&
    
              lResult&=previewit(coid$,pagespreviewed&)
    
              CONTROL DISABLE hDlgPreview,%IDC_GRAPHIC1
    
            CASE 303 'previous page
              PagesPreviewed&=PagesPreviewed&-1 '2
              pageBeingViewed&=PageBeingViewed&-1
              IF PageBeingViewed&<1 THEN PageBeingViewed&=1
              IF PagesPreviewed&<=1 THEN
                PagesPreviewed&=1
                CONTROL KILL hDlgPreview,303
                CONTROL ADD BUTTON, hDlgPreview,303,"Previous",   099,02,45,16 '097,2,45,16
                CONTROL DISABLE hDlgPreview,303
                EXIT IF:EXIT FUNCTION
              END IF
              IF PagesPreviewed&<PagestoPrint& THEN
                'CONTROL ENABLE hDlgPreview,302
                CONTROL KILL hDlgPreview,302
               CONTROL ADD IMGBUTTONX,hDlgPreview,302,"NXT",   052,02,45,16 '047,2,45,16
              END IF
    
              GRAPHIC SET POS (0,0)
              GRAPHIC CLEAR
              GRAPHIC REDRAW
              lResult&=previewit(coid$,pagespreviewed&)
              CONTROL DISABLE hDlgPreview,%IDC_GRAPHIC1
    
            CASE 304 'zoom in/out
              CONTROL KILL hDlgPreview,%IDC_GRAPHIC1
              IF zoom&=0 THEN
                zoom&=1
                nScreenWidth= GetSystemMetrics(%SM_CXSCREEN )
                nScreenHeight= GetSystemMetrics(%SM_CYSCREEN)
                DIALOG PIXELS hDlgPreview,nScreenWidth,nScreenHeight TO UNITS x&,y&
    
                IF PageW!=0 THEN PageW!=8.5
                IF PageH!=0 THEN PageH!=11
                CONTROL KILL hDlgPreview,401
                CONTROL KILL hDlgPreview,402
                CONTROL KILL hDlgPreview,304 'zoom
                graphw&=566/8.5*PageW!
                IF GraphH&=0 THEN GraphH&=300/(PageH!/2)*PageH!/2
                IF pageH!=14 THEN graphh&=300*14/11
                'DIALOG SET SIZE hDlgPreview, Graphw&+40,Graphh&+25 '600,325
                DIALOG SET SIZE hDlgPreview, Graphw&+40,Graphh&+25 '600,325
                DIALOG SET LOC hDlgPreview, 0,0
    
                'CONTROL ADD SCROLLBAR, hDlgPreview,%idc_scrollbar1,"",Graphw&+25,20,30,Graphh&-20,%WS_VSCROLL or %SBS_VERT 'or %WS_TABSTOP
                'ctlstyle& = %WS_CHILD OR %WS_VISIBLE OR %WS_BORDER OR %SS_CENTER OR %WS_HSCROLL OR %WS_VSCROLL OR %SS_NOTIFY ' SS_NOTIFY required to respond to mouse clicks !
                ctlstyle& = %WS_VISIBLE OR %WS_BORDER OR %SS_CENTER OR %WS_VSCROLL OR %SS_NOTIFY ' SS_NOTIFY required to respond to mouse clicks !
                'control add label,hDlgPreview,%IDC_SCROLLBAR1,"",Graphw&+25,20,1,graphh&-20,ctlstyle& '30,Graphh&-20,ctlstyle&
                CONTROL ADD SCROLLBAR,hDlgPreview,%IDC_SCROLLBAR1,"",Graphw&+25,20,40,Graphh&-20,ctlstyle&
                'CONTROL HANDLE hForm1&, %FORM1_LABEL1 TO hCtrl&
                CONTROL HANDLE hDlgPreview, %IDC_SCROLLBAR1 TO hCtrl&
                'OriginalProc=SetWindowLong(hCtrl&, %GWL_WNDPROC, CODEPTR(MySubClassProc))
                'SetScrollRange hwnd, %SB_VERT, 0, UBOUND(sysmetrics), %FALSE
                si.cbSize    = LEN(si)                   ' get place holders for the si parameters
                si.fMask     = %SIF_ALL                  ' setting the topological space for the scroll bars
                si.nMin      = 0                         ' min scroll pos
                si.nMax      = 270 '1 'Graphh&-30 '1 'gphh&-30 'h                         ' max scroll pos
                si.nPage     = 135 '2 'Graphh&-20 '1 'gphh&-20 'vt                        ' lenght of the vertical scroll bar's thumb
                si.npos      = 0
                si.ntrackpos = 0
                'SetScrollRange hCrtl&,%SB_CTL,135,270,%FALSE 'hdlgPreview,%idc_scrollbar1 , 0, 270, %FALSE
    
                'SetScrollInfo CBHNDL, %SB_VERT, si, 1 ' initial setup of the vertical scrollbar, "1" represents
                                                  ' "TRUE" and causes redraw of the scroll bar
                'SetScrollInfo hDlgPreview, %idc_scrollbar1, si, 1 ' initial setup of the vertical scrollbar, "1" represents true
                'SetScrollInfo hCtrl&, %SB_VERT, si, 1 ' initial setup of the vertical scrollbar, "1" represents true
                SetScrollInfo hCtrl&, %SB_CTL, si, 1 ' initial setup of the vertical scrollbar, "1" represents true
                'SetScrollInfo %IDC_SCROLLBAR1,%SB_CTL,si,1 'hCtrl&, %SB_CTL, si, 1
                'CONTROL REDRAW hDlgPreview,%IDC_SCROLLBAR1
                LOCAL xloc&,yloc&
                IF graphw&+40<x& THEN
                  xloc&=(x&-(graphw&+40))/2
                END IF
                IF graphh&+25<y& THEN
                  yloc&=(y&-(graphh&+25))/2-16
                END IF
                IF xloc&<>0 AND yloc&<>0 THEN
                  DIALOG SET LOC hDlgPreview, xloc&,yloc&
                END IF
                DIALOG GET SIZE hDlgPreview TO xsize&,ysize&
                CONTROL ADD IMGBUTTONX, hDlgPreview,304,"ZMO",     146,02,45,16 '147,2,45,16
                 IF xsize&>=566 THEN
                  CONTROL ADD GRAPHIC, hDlgPreview, %IDC_GRAPHIC1, "", (xsize&-Graphw&)/2-4,20,Graphw&,Graphh&,%SS_NOTIFY OR %WS_HSCROLL
                ELSE
                  CONTROL ADD GRAPHIC, hDlgPreview, %IDC_GRAPHIC1, "", 0, 20, Graphw&,Graphh&,%SS_NOTIFY OR %WS_HSCROLL'OR %WS_VSCROLL
                END IF
                CONTROL KILL hDlgPreview,305
                CONTROL ADD IMGBUTTONX, hDlgPreview,305,"PD1",   193,02,45,16
                SetCursor hCurZoomO
              ELSE
                zoom&=0
                nScreenWidth= GetSystemMetrics(%SM_CXSCREEN )
                'LOCAL nScreenHeight AS LONG,y&,yy&
                nScreenHeight= GetSystemMetrics(%SM_CYSCREEN)
                IF PageW!=0 THEN PageW!=8.5
                IF PageH!=0 THEN PageH!=11
                graphw&=293/8.5*PageW!
                GraphH&=PageH!/11*300 '/11*PageH!
                IF PageH!=14 THEN GraphH&=14/11*300
                CONTROL KILL hDlgPreview,304
                CONTROL KILL hDlgPreview,305
                'control kill hDlgPreview,%idc_scrollbar1 '701
                CONTROL ADD IMGBUTTONX, hDlgPreview,304,"ZMI",     146,02,45,16 '147,2,45,16
                CONTROL ADD BUTTON, hDlgPreview,305,"Page Down",   193,02,45,16
                CONTROL DISABLE hDlgPreview,305
                DIALOG SET SIZE hDlgPreview, graphw&+50,Graphh&+40'graphw&+10,Graphh&+40 '293,340
                DIALOG PIXELS hDlgPreview,nScreenWidth,nScreenHeight TO UNITS x&,y&
                xx&=(x&-graphw&-50)/2 '-7)/2 '290)/2
                yy&=(y&-graphh&-40)/2 '-45)/2 '345)/2
                IF xx&>0 AND yy&>0 THEN
                  DIALOG SET LOC hDlgPreview,xx&,yy&-8 '10 ' xx&,yy&
                END IF
                CONTROL ADD GRAPHIC, hDlgPreview, %IDC_GRAPHIC1, "", 23, 20, 293,GraphH&,%SS_NOTIFY
                CONTROL ADD IMAGEX,hDlgPreview,401,"BL1",15,20,08,Graphh& '300',%SS_BLACKFRAME
                CONTROL ADD IMAGEX,hDlgPreview,402,"BL1",316,20,08,graphh& '300',%SS_BLACKFRAME
                'control kill hDlgPreview,%idc_scrollbar1 '701
                zoom&=0:downit&=0
                SetCursor hCurZoom
                'si.nMin      = 0                         ' min scroll pos
                'si.nMax      = 0 'gphh&-30 'h                         ' max scroll pos
                'si.nPage     = 0 'gphh&-20 'vt                        ' lenght of the vertical scroll bar's thumb
                'si.fMask     = 0 '%SIF_ALL'SIF_ALL
                'si.nPos      = 0
                'si.cbsize    = 0
                'si.ntrackpos = 0
                ''SetScrollInfo CBHNDL, %SB_VERT, si, 1 ' initial setup of the vertical scrollbar, "1" represents
                ''setscrollinfo hDlgPreview,%idc_scrollbar1,si,1
                ''SetScrollInfo hCtrl&, %SB_VERT, si, 1
                'SetScrollInfo hCtrl&, %SB_CTL, si, 1
                CONTROL KILLl hDlgPreview,%idc_scrollbar1 
              END IF
              IF pagespreviewed&<pagestoprint& THEN
                CONTROL KILL hDlgPreview,302
                CONTROL ADD IMGBUTTONX,hDlgPreview,302,"NXT",   052,02,45,16 '047,2,45,16
              END IF
              IF pagespreviewed&>1 THEN
                CONTROL KILL hDlgPreview,303
                CONTROL ADD IMGBUTTONX, hDlgPreview,303,"PRV",   099,02,45,16 '097,2,45,16
              END IF
              lResult&=previewit(coid$,pagespreviewed&) 'fil$)
              CONTROL DISABLE hDlgPreview,%IDC_GRAPHIC1
              EXIT FUNCTION
            CASE 305 'down/up
              x2!=8.5*720
              y2!=11*720
              IF pageH!=14 THEN y2!=14*720
              x1!=0:y1!=0
              GetScrollInfo hCtlr&, %SB_CTL, si
            'oldPos = si.nPos
    
              IF downit&=0 THEN
                GRAPHIC SCALE (x1!,y1!)-(x2!,y2!/2)
                Downit&=1
                CONTROL KILL hDlgPreview,305
                CONTROL ADD  IMGBUTTONX,hDlgPreview,305,"PU1",193,02,45,16
                IF PageIsaBMP& THEN
                  'GRAPHIC STRETCH hBMP,0,(0,(bmpHeight&-1)/4)-(bmpWidth&-1,bmpHeight&-1) TO (x1!+180,y1!+300)-(x2!-360,y2!-600)'(0,0)-(529,359)
                  'GRAPHIC REDRAW
                END IF
    
                si.cbSize    = LEN(si)                   ' get place holders for the si parameters
                si.fMask     = %SIF_ALL                  ' setting the topological space for the scroll bars
                si.nMin      = 0                         ' min scroll pos
                si.nMax      = 270 '1 'graphh&-30 'phh&-30 'h                         ' max scroll pos
                si.nPage     = 135 '2 'graphh&-20 'gphh&-20 'vt                        ' lenght of the vertical scroll bar's thumb
                si.npos      = 270 '1 'Graphh&-30 '1 'si.nmax 'gphh&-30 'si.nmax
                si.ntrackpos = 0
                xx&=si.npos
                'SetScrollInfo hDlgPreview, %IDC_Scrollbar1, si, 1 '0
                'SetScrollInfo hCtrl&, %SB_VERT, si, 1
                SetScrollInfo hCtrl&, %SB_CTL, si, 1
                'SetScrollInfo %IDC_Scrollbar1, %SB_VERT,si, 1 '0
                'control redraw didnt help
                'CONTROL REDRAW hDlgPreview,%IDC_SCROLLBAR1
                'dialog redraw hdlgPreview
                'SetScrollPos hDlgPreview,%IDC_Scrollbar1,si.npos,1
                '%SB_VERT, si, 1
              ELSE
                downit&=0
                'GRAPHIC SCALE (x1!,y1!)-(x2!-72,y2!-120)
                GRAPHIC SCALE (x1!,y1!)-(x2!,y2!)
                CONTROL KILL hDlgPreview,305 'SET TEXT hDlgPreview,305,"Page Down"
                CONTROL ADD  IMGBUTTONX,hDlgPreview,305,"PD1",193,02,45,16
                IF PageIsaBMP& THEN
                 'GRAPHIC STRETCH hBMP,0,(0,0)-(bmpWidth&-1,(bmpHeight&-1)/4*3) TO (x1!+180,y1!+300)-(x2!-360,y2!-600)'(0,0)-(529,359)
                 'GRAPHIC REDRAW
                END IF
                IF zoom&=0 THEN
                  si.cbSize    = 0 'LEN(si)                   ' get place holders for the si parameters
                  si.fMask     = 0 '%SIF_ALL                  ' setting the topological space for the scroll bars
                  si.nMin      = 0                         ' min scroll pos
                  si.nMax      = 0 'Graphh&-30 '1 'gphh&-30 'h                         ' max scroll pos
                  si.nPage     = 0 'Graphh&-20 '1 'gphh&-20 'vt                        ' lenght of the vertical scroll bar's thumb
                  si.npos      = 0 'Graphh&-30 '0 'si.nmax
                  si.ntrackpos = 0 '1
                  'SetScrollInfo hDlgPreview, %idc_scrollbar1,si,1
                  'SetScrollInfo hCtrl&, %SB_VERT, si, 1
                  SetScrollInfo hCtrl&, %SB_CTL, si, 1
                  'SetScrollPos hDlgPreview,%IDC_Scrollbar1,si.npos,1
                  CONTROL KILL hDlgPreview,%IDC_SCROLLBAR1
                  SLEEP 10
                ELSE
                  si.cbSize    = LEN(si)                   ' get place holders for the si parameters
                  si.fMask     = %SIF_ALL                  ' setting the topological space for the scroll bars
                  si.nMin      = 0                         ' min scroll pos
                  si.nMax      = 270 '1 'Graphh&-30 '1 'gphh&-30 'h                         ' max scroll pos
                  si.nPage     = 135 '2 'Graphh&-20 '1 'gphh&-20 'vt                        ' lenght of the vertical scroll bar's thumb
                  si.npos      = 0 'si.nmax
                  si.ntrackpos = 0
                  'SetScrollInfo hDlgPreview, %idc_scrollbar1,si,1
                  'SetScrollInfo hCtrl&, %SB_VERT, si, 1
                  SetScrollInfo hCtrl&, %SB_CTL, si, 1
                  'CONTROL REDRAW hDlgPreview,%IDC_SCROLLBAR1 'dialog redraw hDlgPreview
                END IF
              END IF
    
           CONTROL KILL hDlgPreview,302
           CONTROL ADD IMGBUTTONX,hDlgPreview,302,"NXT",   052,02,45,16 '047,2,45,16
    
              lResult&=previewit(coid$,pagespreviewed&) 'fil$)
              CONTROL DISABLE hDlgPreview,%IDC_GRAPHIC1
    
            CASE 306 'cancel
              abort&=1
              CONTROL KILL hDlgPreview,%IDC_GRAPHIC1
              GRAPHIC WINDOW END
              DIALOG END hDlgPreview
            CASE 307 'help -- only shows when zoom in because of no room in smaller dialog
              msg$=           "Zoom in, Zoom out, Page Down."' , Page Up Always revert to"
              msg$=msg$+$CRLF+"Page Down or scroll bar can used  to view the lower" '1 for the preview. This is to insure that the scale"
              msg$=msg$+$CRLF+"portion of the page after zooming in."'and any other necessary information is correctly displayed."
              msg$=msg$+$CRLF+"Next Page and Previous Page are self explanatory."
              msg$=msg$+$CRLF+"Cancel returns to the menu,Print sends report to the printer."
              msg$=msg$+$CRLF+" "
              msg$=msg$+$CRLF+"Next is disabled if total pages=1 or viewing last page."
              msg$=msg$+$CRLF+"Previous is disabled if total pages=1 or viewing page 1."
              msg$=msg$+$CRLF+"Page Down/Page Up is disabled unless in zoom mode."
              msg$=msg$+$CRLF+" "
              msg$=msg$+$CRLF+"Click Zoom In (or just click mouse with Zoom+ showing to zoom"
              msg$=msg$+$CRLF+"in to the top half of the page. Click mouse again or click"
              msg$=msg$+$CRLF+"the Zoom Out button to return to full page preview."
              MSGBOX msg$,,"Preview Help"
    
            CASE ELSE
    
          END SELECT
      END SELECT
    
    END FUNCTION
    Last edited by Fred Buffington; 10 Jan 2008, 04:25 PM.
    Client Writeup for the CPA

    buffs.proboards2.com

    Links Page

  • #2
    make scroll bars go away

    Fred,

    Basically, to make scrollbars go away, this is what I do...

    Code:
    'please pardon my C code - quickest to come up with...
    pMainWindowData->ed.si.fMask=SIF_ALL;
    pMainWindowData->ed.si.nMin=0;
    pMainWindowData->ed.si.nMax=0;
    pMainWindowData->ed.si.nPos=0;
    SetScrollInfo(pMainWindowData->hGrid, SB_VERT, &pMWD->ed.si, TRUE);
    If the nMin=nMax=0, I believe that's sufficient?

    Fred
    Fred
    "fharris"+Chr$(64)+"evenlink"+Chr$(46)+"com"

    Comment


    • #3
      Thanks Fred. knew it was something i was overlooking. I'll try it right now.

      I added that si.nmin= 0 , and si.nmax=0, and si.npos=0 and setscrollinfo and it didnt help
      see code below
      'new code added per Fred Harris
      Last edited by Fred Buffington; 9 Jan 2008, 09:39 AM.
      Client Writeup for the CPA

      buffs.proboards2.com

      Links Page

      Comment


      • #4
        I saw you were using the SCROLLINFO type as I do Fred. I also noticed some of your variables that you were loading into si.nMin & si.nMax. Perhaps some of your variables are holding values other than zero when you are calling SetScrollInfo(). If that's the case, that would probably cause the scroll bar to not disappear.
        Fred
        "fharris"+Chr$(64)+"evenlink"+Chr$(46)+"com"

        Comment


        • #5
          hmm well i finished setting all the scrollinfo stuff
          si.nMin = 0
          si.nMax = 0
          si.nPage = 0
          si.fMask = 0
          si.nPos = 0
          si.cbsize = 0
          si.ntrackpos=0
          still no success.
          Frustrated..LOL
          Client Writeup for the CPA

          buffs.proboards2.com

          Links Page

          Comment


          • #6
            Fred,

            I believe you created a Scroll Bar Control, didn't you (I don't follow DDT code real good)? If that's the case, you need to place the handle of the scroll bar as the first parameter in the SetScrollInfo(hScrollBar,...), not CBHNDL, which is the parent of the scroll bar.

            If the verticle scroll bar was placed on the parent as one of the Window Styles, i.e., WS_VSCROLL, then CBHNDL with %SB_VERT would work.

            Fred
            Fred
            "fharris"+Chr$(64)+"evenlink"+Chr$(46)+"com"

            Comment


            • #7
              yea, figured that out. thought i had posted this answer but now dont see it
              Partial success. I did do that. I already had an %idc_scrollbar1 defined so used
              that in place of the %sb_vert. and was sure all values were zero and success.

              But now it wont position the thingy at the bottom when i click on it.
              See it should only have 2 positions - top and at bottom since in zoom mode
              it shows the top half or the bottom half.

              Now clicking the scrollbar does make it toggle between showing the top or bottom of the report (graphic) (as it always did) but the thingy stays at the top of the scrollbar while before it went to the bottom then back up to the top on alternate clicks.

              I'll repost the modifed callback in place of the original one.
              Last edited by Fred Buffington; 9 Jan 2008, 10:36 AM.
              Client Writeup for the CPA

              buffs.proboards2.com

              Links Page

              Comment


              • #8
                If the scroll bar only has two positions, then nMin=0 and nMax=1 should take care of that calibration. Of course, when code executes to move your data, you need to call SetScrollInfo() and 'set'' the nPos to 0 or 1 as the case may be.
                Fred
                "fharris"+Chr$(64)+"evenlink"+Chr$(46)+"com"

                Comment


                • #9
                  It is now working great.

                  **It pays to read the help.**

                  With a control add scrollbar, when using setscrollinfo you should use
                  %SB_CTL rather than %SB_VERT or %SB_HORIZ as the flag.

                  This one change solved the display of the scrollbar to the top/bottom.

                  Had previously fixed the scrollbar not disappearing (as previously noted) with Fred Harris' help.

                  Thanks Fred.
                  Client Writeup for the CPA

                  buffs.proboards2.com

                  Links Page

                  Comment


                  • #10
                    Geez, I forgot to mention that too, but you figured it out Fred! One other thing, I believe the visibility of a scroll bar control can also be set with the ShowWindow() api call where you place the hWnd of scroll bar as first parameter, and use the various equates such as %SW_SHOW, %SW_HIDE, etc. However, if this setting gets screwed up anyway in your code you can end up with a situation where the durn thing should be one way but its the other! I think modifying the .nMin and .nMax TYPE members of SCROLLINFO is the way to go.
                    Fred
                    "fharris"+Chr$(64)+"evenlink"+Chr$(46)+"com"

                    Comment


                    • #11
                      The only thing now is a minor annoyance.

                      again here is the senario.
                      In full page view no scrollbar should be visible . done!
                      In zoom mode, when first goes into it, scrollbar visible. done!
                      since there are only top and bottom to show, the 'bar' is 1/2 the way down
                      (from the top to the middle). done! sortof

                      when bar clicked, toggles to bottom or top depending on what is showing.
                      this works fine. bar shows 1/2 of scrollbar. OK.

                      here is the sortof.

                      if I go back to the full page, the scrollbar disappears (as it should).
                      If i then go back into 'zoom', the 'bar' is small instead of extending half the way down as it does the first time.

                      Now if i click on the scroll bar to go down the page, it returns to the showing
                      the bar half way as it is supposed to do and works fine.

                      so, it's only going into zoom mode the second time on that initially the bar (not the entire scrollbar area but just the bar part) is small instead of half way. Once clicked it returns to the half way and displays correctly.

                      Strange.

                      I guess to be more clear the 'bar' should be referred to as the 'slider?'
                      Last edited by Fred Buffington; 10 Jan 2008, 02:23 PM.
                      Client Writeup for the CPA

                      buffs.proboards2.com

                      Links Page

                      Comment


                      • #12
                        I've never fooled around with the size of the scroll bar 'thumb' (I believe that's the correct term). The documentation seems to be saying that's determined by the nPage member of SCROLLINFO. Check out SetScrollInfo() for what little info is given on that. I guess I'm easy to satisfy and have always been happy with what Windows gave me. It sounds like something is going on there for you though.
                        Fred
                        "fharris"+Chr$(64)+"evenlink"+Chr$(46)+"com"

                        Comment


                        • #13
                          I have that part correct im sure. I set si.npage to 135 while si.nmax is 270
                          si.npos is either 0 or 270. The only place it is different is when i 'eliminate'
                          the scrollbar with the setscrollinfo with all zeros. I even tried leaving the page
                          value at 135 there too but didnt help.

                          I will try just control delete without the setscrollinfo with all zeros but i dont think that will work.

                          Well i'll be, that did it.
                          I removed (remmed) the si.nwhatever = 0 lines
                          and remmed the setscrollinfo in the place where it eliminates the scrollbar
                          replaced with control kill hDlgPreview, %IDC_SCROLLBAR1 and wahlah.

                          Thank you again Fred for spending so much time on my little program. Hope i can
                          repay it in the future.
                          Last edited by Fred Buffington; 10 Jan 2008, 04:22 PM.
                          Client Writeup for the CPA

                          buffs.proboards2.com

                          Links Page

                          Comment

                          Working...
                          X