Microsoft KB Archive/45480

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Knowledge Base


How to Draw Border Around BUTTON in QuickBASIC for Macintosh

Article ID: 45480

Article Last Modified on 11/21/2006

This article was previously published under Q45480

SUMMARY

This article discusses how to draw bordered buttons in QuickBASIC for the Apple Macintosh. The border is drawn in the code example below using the FRAMEROUNDRECT statement.

A bordered button has a darker outline than other buttons in a dialog box. A bordered button shows you which button is activated if you just press ENTER from the keyboard instead of clicking a button with your mouse.

MORE INFORMATION

Note: The technique below doesn't let you make bordered buttons in customized dialog or alert box resources created by ResEdit.

You can see an example of a bordered button within the QuickBASIC editor by choosing Options from the Run menu. In the dialog box that appears, the double border on OK shows you that this button will be selected if you press the ENTER key on the keyboard.

Code Example

GetButton b,2!
PRINT b

SUB GetButton(actual,Default) STATIC
    WINDOW 2,"",(100,100)-(300,200),2
    MakeButton 1!,"1",10!,50!,40!,70!,Default
    MakeButton 2!,"2",60!,50!,90!,70!,Default
    MakeButton 3!,"3",110!,50!,140!,70!,Default
    d=0 : WHILE (d<>6) AND (d<>1) :d=DIALOG(0) : WEND
    IF d=6 THEN actual=Default ELSE actual=DIALOG(1)
    WINDOW CLOSE 2
END SUB

SUB MakeButton(n!,title$,x1,y1,x2,y2,Default) STATIC
    BUTTON n,1,title$,(x1,y1)-(x2,y2)
    IF Default =n! THEN
        PENSIZE 3,3
        r%(0)=y1-4 : r%(1)=x1-4 : r%(2)=y2+4 : r%(3)=x2+4
        FRAMEROUNDRECT VARPTR(r%(0)),16,16
        PENSIZE 1,1
    END IF
END SUB
                


Additional query words: MQuickB

Keywords: KB45480