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

PG PRO

Manipulate PG TEXT resources


Please find some functions I use to manipulate PG TEXT resources.

This one changes the state of an editfield pG3c resource.

LOCAL FN ChangeEFObj(ObjectRef,ObjPType) 'Change state of EField obj
  EDIT FIELD ObjectRef,,,ObjPType 'Change state of EField
  theObj = FN pGgetRef(gWhichClass,ObjectRef) 'Get pG3c data of EField
  gObjZType = ObjPType 'Change state in pG3c data
  FN pGputObj(gWhichClass,theObj) 'Save for future use
END FN

This function takes text in an editfield & stores it in the appropriate pG3t resource, if you tweak this function you should be able to change the pG3t recource before opening the window where the editfield is by passing your text to the eFHndl& & not getting what is already in the editfield.

LOCAL FN ChangeEFText(ObjectRef) 'Change text in EField
  EDIT FIELD ObjectRef 'Activate EField
  theObj = FN pGgetRef(gWhichClass,ObjectRef) 'Get pG3c data on EField
  GET FIELD eFHndl&,ObjectRef 'Get handle to text & style data for EField
  LONG IF eFHndl& 'Check handle exists
    FN pGreplaceRes(eFHndl&,_"pG3t",gObjResID,"")'Replace matching pG3t rescorce
    KILL FIELD eFHndl& 'Kill handle to EField text & style
  END IF
END FN

Oh & don't forget to add the appropriate pG globalisation functions.

Chris Wyatt