Jump to content
Developer Wiki and Function Reference Links ×

Formatting PIO Text on the fly


Sam Jones

Recommended Posts

I have a point PIO that has a CreateText() command in it.   When it is placed, the document font and text style chosen in the Text menu are used.  All well and good.  I would like to be able to select existing instances of the PIO and choose a new font and text style from the Text menu and have those selected instances use the newly selected font and text style for the CreateText() procedure in the Reset Event.  I have seen other PIOs do this, but currently instances of my PIO will not.  There are no text formatting procedures in the PIO code except for some alignment procedures.  How can I get my PIO to respond to the text formatting selected.  😁 😁

Link to comment

@Sam Jones,

   Not sure if this is pertinent, but there is an Object Property for event-enabled PIO's that looks like it might be applicable. I don't have a way to test it now. 

If @JBenghiat chimes in you may get better advice.

 

const ObjectPropID kObjXPropTextStyleSupport = 42;   //      NO    // Controls whether parametric objects can use class text style attribute and get Text Style on OIP 
//        // Boolean                                                                //                //   Set TRUE if the object supports this
//                                                                                        //                //   e.g. Almost all text-related PIOs set this yes, for support by default.
 

   If I guess right, you would put it in event kObjOnInitXProperties {5} along with your other property settings with something like this:

 

case theEvent of

   ...

   kObjOnInitXProperties: begin     { 5 } 
      result := SetObjPropVS(kObjXPropTextStyleSupport, TRUE);      { 42, Controls whether parametric objects can use class text style attribute and get Text Style on OIP. }
   ...

   end;     { 5 }

 

   Please post back if you get it to work, or not. I, for one, would really like to know.

 

Good luck,

Raymond

Edited by MullinRJ
Link to comment

@michaelk has the answer. Note that there is a bug where not all text attributes get saved — I know alignment does not, and possibly line spacing, so you would have to manually code those (either set to a constant value or store to a parameter)

 

@MullinRJ what you’re finding are the options to display the text style menu in the OIP. I believe that you also need object variable 800 on for style assignment to work automatically, otherwise you need to get the object’s text style and apply it to each text block. 

  • Like 1
Link to comment

Assuming that "BooResult := GetCustomObjectInfo(PIOName, PIOHan, PIORecHan, PIOWallHan);" has been run before the "CASE TheEvent OF", the PIOHan is NIL during the kObjOnInitXProperties event and the PIORecHan won't recognize the 800 constant.  So the question becomes where to put the "SetObjectVariableBoolean(PIOHan, 800, TRUE);".

 

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...