alberto72 Posted January 5, 2021 Share Posted January 5, 2021 (edited) I've got an event-enabled linear PIO that raise a custom dialog with a double click on it. It works fine swapping values between custom dialog and info object palette. I've implemented dialog handle procedure with item 1 (OK Button), item 2 (CancelButton). Now I would like to add item 12605 (preview button) which would operate as the Ok button (updating PIO ), but without exit from dialog. It doesn't work at all because seems that you must exit from the dialog event loop to obtain PIO updating. Thanks in advance for any suggestion. Edited January 5, 2021 by alberto72 Quote Link to comment
JBenghiat Posted January 5, 2021 Share Posted January 5, 2021 You should be able to reset the object while the dialog is running. Make sure to add a ResetObject() and a ReDrawAll(). You can use BeginContext/EndContext to restore values if the user presses Cancel. Quote Link to comment
alberto72 Posted January 6, 2021 Author Share Posted January 6, 2021 I tried to implement your advice but it was unsuccessful. It seems that only some instructions are executed during the dialogue loop such as:AlrtDialog(), CreateText()+ReDrawAll(). Here is my Dialog_Handler function which I'm working at..... def Dialog_Handler(item, data): (ok, objectName, objectHand, recordHand, wallHand) = GetCustomObjectInfo() def update_and_execute():#===== this subroutine is intended to be used with item==1 and item ==12605 # ========retrieving values====== esito,inter.c1 = GetEditReal(dialogID,12,3) esito,inter.c2 = GetEditReal(dialogID,14,3) (outSelectedIndex, outSelectedChoiceText) =GetSelectedChoiceInfo(dialogID, 16, 0) inter.d = outSelectedChoiceText # ========= updating object info palette=== SetRField(objectHand, GetName(recordHand), 'ci',str(inter.c1/10) ) SetRField(objectHand, GetName(recordHand), 'cf',str(inter.c2/10)) SetRField(objectHand, GetName(recordHand), 'diam', inter.d) ResetObject(objectHand) if item == 12255:# SetupDialogC -> My Custom Window Init AddChoice(dialogID, 16, '8', 0) AddChoice(dialogID, 16, '10', 1) AddChoice(dialogID, 16, '12', 2) if v3 =="8": choice = 0 elif v3 =="10": choice = 1 elif v3 =="12": choice = 2 SelectChoice(dialogID, 16, choice, False)#=====update pulldown menu -> OK! elif item == 2:#=====Cancel button pressed -> OK! pass elif item ==1: #==== OK button pressed -> OK! update_and_execute() elif item == 12605 :# ======Preview button pressed -> AlrtDialog(('item= '+ str(item) + ' data= '+ str(data)))#===== THIS WORKS update_and_execute()#=====THIS DOESN'T REGENERATE PIO AS item==1 DOES ! ResetObject(objectHand)#=====THIS DOESN'T WORK TOO ! CreateText(str(item))#==== THIS WORKS WITH ReDrawAll() ! ReDrawAll() 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.