Microsoft KB Archive/34344

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 14:14, 21 July 2020 by X010 (talk | contribs) (Text replacement - "&" to "&")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base


ScrollText Example to Specify Leading Spacing in Scroll Bar

Article ID: 34344

Article Last Modified on 1/9/2003



APPLIES TO

  • Microsoft QuickBasic Compiler for Macintosh 1.0



This article was previously published under Q34344

SUMMARY

The following information needs to be added to the ScrollText statement on Page 492 of the "Microsoft QuickBasic for Macintosh: Basic Language Reference":

E.10.2 Toolbox Library Statement Reference




ScrollText H&,rec%(0),a$(0),top%,rows%[,num%[,delay%[,leading%]]]

Scrolltext now has an additional optional parameter that specifies the leading (space between lines) in pixels. The default is 4 pixels.


This information was taken from the README.DOC file from the Version 1.00 release disk, except the README.DOC incorrectly says the information applies to Page 519 rather than Page 492. A code example of using the leading% parameter is shown below.

MORE INFORMATION

For more information, please see Section E.5, "Scrolling," on Pages 432, 433, and 434 of the "Microsoft QuickBasic for Macintosh: Basic Language Reference."

The [optional] "leading" parameter determines the amount of space between items in the scroll area. The value for "leading" should be added to the calculation used to calculate the vertical position of the font being used:

   vertpos% =inf%(1)+inf%(2)+inf%(4)+leading%
                

Below is an example of using the "leading" parameter:

Code Example

OPTION BASE 1
leading%=4         ' "leading" pixel parameter
dim inf(4)
REM    inf(1) = font ascent
REM    inf(2) = font descent
REM    inf(4) = vertical distance between descent line and
REM               the ascent line below it.

GetFontInfo inf%(1)
vertpos% =inf%(1)+inf%(2)+inf%(4)+leading%
linenum%=0
top%=0
s&=0
in%=0
DIM ref%,p!,p.id%,pt!,pat.id,reg!,d!,in%,s!
DIM top%,linenum%,curs%,inpic%,inscr%'
setrect scr%(1),3,6,114,111
setrect bar%(1),113,6,129,111
FRAMERECT VARPTR(scr%(1))
newscroll s&,bar%(1),1,1,10,1
FOR i=1 TO 10
 READ s$(i)
NEXT i
DATA one,two,three,four,five,six,seven,eight,nine,ten
REM *************DETERMINE LINE CLICKED***************
GetMouse pt%(1)
PtInRect pt%(1),irec%(1),inpic%
PtInRect pt%(1),scr%(1),inscr%
linenum%=(pt%(1)-6)\vertpos%+top%
REM **************************************************
REM *************SELECT LINE CLICKED******************
ScrollText s&,scr%(1),s$(1),top%,10,linenum%,,leading%
REM **************************************************
    '****** main loop ******
    INITCURSOR
    WHILE 1
      ScrollText s&,scr%(1),s$(1),top%,10,linenum%,,leading%
      GetMouse pt%(1)
      PtInRect pt%(1),crec%(1),in%
      IF in% THEN ChangeCursor curs% ELSE INITCURSOR
        IF DIALOG(0)=1 THEN
            GOSUB doButton
        ELSEIF MOUSE(0)<>0 THEN
            GOSUB doMouse
        ELSEIF MENU(0)<>0 THEN
            IF MENU(1)=1 THEN :DisposeScroll s! :END
        END IF
    WEND

doButton:
    but=DIALOG(1)
    SELECT CASE but
    CASE 1
        IF p.id%<>0 THEN ReleaseRes p!:ERASERECT VARPTR(prec%(1))
        IF p.id%<7 THEN p.id%=p.id%+1 ELSE p.id%=1
        GetPicture ref%,p.id%,p!
        DrawPicture p!,,prec%(1)
    END SELECT
    RETURN

doMouse:
    GetMouse pt%(1)
    PtInRect pt%(1),irec%(1),inpic%
    PtInRect pt%(1),scr%(1),inscr%
      linenum%=(pt%(1)-6)\vertpos%+top%
      top%=0
      ScrollText s&,scr%(1),s$(1),top%,10,linenum%,,leading%
      WHILE MOUSE(0)<>0:WEND
    RETURN
DisposeScroll s&
                


Additional query words: MQuickB readme docerr

Keywords: KB34344