Jump to content

Preview button ti update a PIO...

Recommended Posts

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 by alberto72
Link to comment

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)

        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!

        elif item ==1: #====  OK button pressed -> OK!

        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() !


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.

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...