Announcement

Collapse
No announcement yet.

Dialog with scrollbar

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

  • Dialog with scrollbar

    How to get a scroll bar to work? This lot certainly does not!
    The qDlg& is filled up with lines beyond its length, and, clickig the up-arrow at the top of the scrollbar, some partial scrolling occurs, so that of the 19 lines on view, the first three remain unmoved, and the last four as well. Half of the fifth-last line scrolls up on the second "UP" clicked. Only the left two-thirds (approx.) of the length of the lines scroll, the rightmost ends stay put.
    Code:
     '----------------------------------------------------------------------
     Style = %WS_POPUP Or _
             %WS_BORDER Or _
             %DS_NOFAILCREATE Or _
             %WS_VSCROLL   
    
     Dialog New hDlg&, "", 13, 109, 402, 195, Style To qDlg&
     
     Style = %WS_POPUP Or _
             %DS_SETFONT Or _
             %DS_NOFAILCREATE Or _
             %DS_MODALFRAME Or _
             %DS_SETFOREGROUND
             
     Dialog New qDlg&, "", 11, 303, 406, 60, Style To fDlg&
    
    '----------------------------------------------------------------------
    CallBack Function EditLetter
     Static scrlPos As Long
     Local wParam As Long
     Local lpr As RECT
     Local lpc As RECT
    
     If CbHndl<>qDlg& Or CbMsg=%WM_INITDIALOG Then Exit Function
    
     Select Case CbMsg
    
     Case %WM_VSCROLL
      wParam = CbWparam
      xPos&=scrlPos
      Mve&=0
      Select Case LoWrd(wParam)
      Case %SB_PAGEDOWN
       scrlPos=scrlPos+240
       CurQln&=CurQln&+20
       Mve&=-240
      Case %SB_LINEDOWN
       scrlPos=scrlPos+12
       CurQln&=CurQln&+1
       Mve&=-12
      Case %SB_PAGEUP
       scrlPos=scrlPos-240
       CurQln&=CurQln&-20
       Mve&=240
      Case %SB_LINEUP
       scrlPos=scrlPos-12
       CurQln&=CurQln&-1
       Mve&=12
      Case %SB_THUMBPOSITION, %SB_THUMBTRACK
       scrlPos = HiWrd(wParam)
       CurQln&=scrlPos\12
       Mve&=(xPos&-scrlPos)\12
       End Select
      If scrlPos>QLlines&*12+109 Then scrlPos=QLlines&*12+109
      If ScrlPos<109 Then scrlPos=109
      SetScrollPos qDlg, %SB_CTL, scrlPos, %TRUE
      Dialog Get Loc qDlg& To Qleft&, Qtop&
    '  Dialog Get Client hDlg& To Qleft&, Qtop&
    '  Dialog Units hDlg&, x&, y& To Pixels Qleft&, Qtop&
    '  Dialog Pixels hDlg&, x&, y& To Units Qleft&, Qtop&
      Dialog Get Size qDlg& To Qwidth&, Qdepth&
    '  MoveWindow hBack, -xPos&, -scrlPos, Qwidth&, Qdepth&, %TRUE
      lpr.nTop=Qtop&
      lpr.nBottom=Qtop&+Qdepth&-1
      lpr.nLeft=Qleft&
      lpr.nRight=Qleft&+Qwidth&-1
      lpc.nTop=Qtop&
      lpc.nBottom=Qtop&+Qdepth&-1
      lpc.nLeft=Qleft&
      lpc.nRight=Qleft&+Qwidth&-1
      ScrollWindow qDlg&, 0, Mve&, lpr, lpr
    '  ScrollWindow(Handle, MovementX, MovementY, @ScrollArea, @ScrollArea);               '(this bit appears in a Delphi .PAS module)
    '  UpdateWindow qDlg&
    '  SetForegroundWindow pDlg&
    '  SetForegroundWindow hDlg&
      End Select
     End Function
    Last edited by Gary Beene; 12 Jul 2014, 07:34 PM. Reason: Code: tags

  • #2
    Sorry! Didn't see the topic already raised further down the list.
    Have saved all that and can now investigate the omitted HELP item.



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

    Comment

    Working...
    X