FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

RESOURCES

Frame any button in DLOG


Heres a function you can use to "frame" any button you want in a DLOG (1st or not).
LOCAL FN DLOGFrameBtn(whichDLOG&,whichItem):' frames a DLOG item
  DIM t,l,b,r:'                              default rect to use
  CALL GETDITEM(whichDLOG&,whichItem,theType,theHandle&,t)
  LONG IF theType=4:'          make sure we want to frame a BUTTON
    CALL INSETRECT(t,-4,-4):'                   expand the rect
    PEN 3,3,1,8,0:'                          select the PEN to use
    CALL FRAMEROUNDRECT(t,16,16):'              frame the item now
    CALL PENNORMAL:'                         restore the pen stats
  END IF
END FN
Pass it a DLOG Pointer and the number of button and it will frame it. Do this before calling "ShowDialog" like this:
LOCAL FN showDialog(whichDLOG)
  CALL GETPORT(oldWnd&):'                  get the current grafport in use
  DLOGptr&=FN GETNEWDIALOG(whichDLOG,0,-1):'  returns a handle to resource
  LONG IF DLOGptr&:'                             make sure we got a handle
    CALL SETPORT(DLOGptr&):'                 enable the port for this DLOG
    FN DLOGpre(DLOGptr&,whichDLOG):'   and go handle any processing before
    FN DLOGFrameBtn(DLOGptr&,1):'               go frame the dialog button
    CALL DRAWDIALOG(DLOGptr&):'                           and then draw it
    DO
      CALL MODALDIALOG(0,gHitItem):'         wait for a click or something
      FN DLOGafter(DLOGptr&,whichDLOG):'        and then handle any clicks
    UNTIL gHitItem=1 OR gHitItem=2 OR gHitItem=3:'   wait for cancel or OK
    CALL SETPORT(oldWnd&):'                       set output to the window
    CALL DISPOSDIALOG(DLOGptr&):'             get rid of the dialog itself
  END IF
END FN
Mel Patrick