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

CONTROLS

Change the name of a control


This shows how to change the title of a button (or any other control) in a DLOG. To run the demo, you will obviously need to have a resource file with an appropriate DLOG.
COMPILE ,_dimmedVarsOnly
RESOURCES "DLOGButton.rsrc"
'resource file with DLOG 128 that has a button whose itemNum is 1

LOCAL FN SetDlgBtnTitle (dlogPtr&, itemNum, newTitle$)
 DIM itemType, itemHndl&, itemBBox;8
 CALL GETDITEM (dlogPtr&, itemNum, itemType, itemHndl&, itemBBox)
 CALL SETCTITLE (itemHndl&, newTitle$)
END FN

DIM itemHit,dlogPtr&
dlogPtr& = FN GETNEWDIALOG (128, 0, -1)
LONG IF dlogPtr&
 DO
  CALL MODALDIALOG (0, itemHit) ' show original
 UNTIL itemHit=1
 FN SetDlgBtnTitle(dlogPtr&, 1, "Hello Darling")
 DO
  CALL MODALDIALOG (0, itemHit) ' show new title
 UNTIL itemHit=1
END IF
CALL DISPOSDIALOG (dlogPtr&)
Robert