Sam Jones Posted October 25, 2023 Share Posted October 25, 2023 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. 😁 😁 Quote Link to comment
MullinRJ Posted October 25, 2023 Share Posted October 25, 2023 (edited) @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 October 25, 2023 by MullinRJ Quote Link to comment
michaelk Posted October 25, 2023 Share Posted October 25, 2023 Doesn't SetObjectVariableBoolean(objHd, 800, TRUE); do this? 2 Quote Link to comment
MullinRJ Posted October 25, 2023 Share Posted October 25, 2023 Thanks, @michaelk, I was looking for that earlier and couldn't find it. I would definitely start there first. Much easier than making a PIO event-enabled, but I'd still like to know how kObjXPropTextStyleSupport affects things. Raymond Quote Link to comment
JBenghiat Posted October 25, 2023 Share Posted October 25, 2023 @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. 1 Quote Link to comment
Sam Jones Posted October 25, 2023 Author Share Posted October 25, 2023 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);". Quote Link to comment
Sam Jones Posted October 25, 2023 Author Share Posted October 25, 2023 Quick answer: At the beginning of the kResetEventID 1 Quote Link to comment
Jesse Cogswell Posted October 25, 2023 Share Posted October 25, 2023 I almost always have a statement like this in my PIO objects as part of the reset event or near the top of my driver before the event case: IF GetCustomObjectInfo(objName,objHd,recHd,wallHd) THEN SetObjectVariableBoolean(objHd,800,TRUE); Quote Link to comment
Recommended Posts
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.