[futurebasic] PG pg3t text changer FN

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 1999 : Group Archive : Group : All Groups

From: "Chris Wyatt." <spacenaut@...>
Date: Fri, 19 Feb 1999 20:50:48 +1100
G'day David,

you wrote:

> Date: Thu, 18 Feb 1999 14:56:57 +1100
> To: futurebasic@...
> From: David <David.Cottrell@...>
> Subject: PG pg3t edit field problem
> Message-Id: <3.0.5.32.19990218145657.0089ab20@...>
>
> I want to open a PG window with some text in an edit field. The problem is
> that the text changes depending on other events.
>
> If I use Edit$ = theString$ when the window is first drawn, the text does
> not appear untill some subsequent update of the window is forced. I think
> the problem is that it takes too long for the window to draw!
>
> Anyone know how to take a string (only a few words really) and replace the
> contents of the pg3t resource (which is where PG looks for whatever goes
> into the Edit field to start with).
>
> Thanks again
>
> david

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.

Regards,

Chris Wyatt, in Bendigo, Victoria, Australia.