Sam Jones Posted October 8, 2023 Share Posted October 8, 2023 I have a point PIO, that puts up a StrDialog() to ask a question when the PIO is inserted. This is triggered in the Reset Event and only triggered if the PIO instance is new. Unfortunately, The StrDialog is triggered when the PIO is selected in the tool Palette and then triggered again when when the first instance is placed. After that, the StrDialog correctly only appears when a PIO is placed. If I select another tool, the problem reappears when the PIO is again selected in the tool palette. Is there a way to differentiate the time when a point PIO is selected in the tool palette, from when it is placed in the drawing? As always, TIA Quote Link to comment
JBenghiat Posted October 8, 2023 Share Posted October 8, 2023 The point object creates a preview for the tool. Check if the parent is NIL. Quote Link to comment
Sam Jones Posted October 8, 2023 Author Share Posted October 8, 2023 The parent of what, and do I want the parent to be nil when I select the PIO in the palette in order to suppress the StrDialog? Prior to the event Case test I have the following lines BooResult := GetCustomObjectInfo(PIOName, PIOHan, PIORecHan, PIOWallHan); vsoGetEventInfo(TheEvent, EventMessage); At the beginning of the ResetEvent procedure I set the IsNew variable with IsNew := IsNewCustomObject('RG Grid Marker'); In the ResetEvent procedure I draw the graphic and then have the following test: IF (IsNew & (GetParent(PIOHan) = NIL)) THEN {Post the StrDialog()} Quote Link to comment
Sam Jones Posted October 8, 2023 Author Share Posted October 8, 2023 The lines I posted above do not suppress the StrDialog() when I select the PIO in the palette. Quote Link to comment
JBenghiat Posted October 8, 2023 Share Posted October 8, 2023 1 hour ago, Sam Jones said: The parent of what, and do I want the parent to be nil when I select the PIO in the palette in order to suppress the StrDialog? Prior to the event Case test I have the following lines BooResult := GetCustomObjectInfo(PIOName, PIOHan, PIORecHan, PIOWallHan); vsoGetEventInfo(TheEvent, EventMessage); At the beginning of the ResetEvent procedure I set the IsNew variable with IsNew := IsNewCustomObject('RG Grid Marker'); In the ResetEvent procedure I draw the graphic and then have the following test: IF (IsNew & (GetParent(PIOHan) = NIL)) THEN {Post the StrDialog()} The parent of PIOHan. You have the test backwards: In preview, the PIO will not have a parent. When placed in the drawing, the parent will be non-nil, and the type will be layer, group, symbol, etc. (If somehow the preview is also non-NIL, check they type). Also be sure to test for duplications and copy/paste. IsNew may be true for both. I think you can get around it with the FirstRegen state (I don't have the constant in front of me) or by setting a hidden field to check if the object is new. 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.