• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Click are still executed after disabling and re-enabling...

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 143
  • Views 5756
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Click are still executed after disabling and re-enabling form buttons while executing a button callback

Marvin Dale
Marvin Dale over 2 years ago

I have a form, created with hiCreateLayoutForm. When the OK or Apply buttons are pressed the form executes a process that takes a long time to complete. While this process is being executed the form should remain open but this gives the user the opportunity to press the buttons again before the process completes. This can cause unexpected behaviour so the form buttons should be disabled while the process is executing.

I've attempted to implement this by disabling the form buttons using hiSetFormButtonEnabled(form 'OK nil) before executing the long process. Then once the long process has complete I re-enable the buttons by calling hiSetFormButtonEnabled(form 'OK t).

The issue is that although while the buttons are disabled clicking them does nothing, once the buttons are reenabled all the buttons clicks that occurred while the buttons were disabled are executed.

I think this could be because the buttons are being disabled and re-enabled in the same button callback and the clicks are being queued and only being handled after the callback has finished. I have tested only disabling the buttons and executing the long process in the callback, then manually reenabling the buttons by calling hiSetFormButtonEnabled in the command interpreter window (CIW). In this situation the behaviour is as expected and any clicks that occurred while the buttons were disabled do nothing.

I've tried using hiFlush, hiSynchronize and hiEnqueueCmd but didn't see any change in behaviour

In the form unmapAfterCB is nil in the form.

Any solutions to this issue or any suggestions of things to try are appreciated.

Thanks

  • Cancel
  • AurelBuche
    AurelBuche over 2 years ago

    Hi Marvin,

    This is weird, normally when a button is disabled, the clicks are not taken in account at all...
    (You should precise the Virtuoso version as maybe this changed between versions)

    A solution would be to disable the button callback as well until you re-enable the button
    I wrote you a code snippet which only works in SKILL++

    (inScheme
    (let (print_button_cb)
    
      (defun do_nothing (@rest _args)
        "Always return nil"
        nil)
    
      (defun print_hello_world (@rest _args)
        "Print 'Hello World!'"
        (printf "Hello World!\n"))
    
      (setq print_button_cb print_hello_world)
    
      (defglobalfun display_custom_form (@rest _args)
        "Display 'Custom Form' Interface"
        (hiDisplayForm
          (hiCreateLayoutForm 'custom_form "Custom Form"
            (hiCreateFormLayout 'main_layout ?items (list
                ;; First button to be disabled
                (hiCreateButton
                  ?name       'print_button
                  ?buttonText "Print 'Hello World!'"
                  ;; print_button_cb is wrapped inside a lambda : this is important!
                  ;; if we do ?callback print_button_cb, and modify the content of print_button_cb afterwards
                  ;; The button will keep the function that was previously defined
                  ?callback   (lambda (@rest _args) (print_button_cb))
                  );print_button
                (hiCreateButton
                  ?name       'wait_button
                  ?buttonText "Disable Other Button For 5 Sec"
                  ?callback
                  (lambda (@rest _args)
                    ;; We need to use `dynamic' as form is automatically defined by its name in SKILL
                    ;; but not in SKILL++
                    (setf (dynamic custom_form)->print_button->enabled nil)
                    (setq print_button_cb do_nothing); If you comment this line, you should realize clicks are not taken in account while button is disabled
                    ;; Wait for 5 seconds then re-enable other button
                    (ipcBeginProcess "sleep 5" "" do_nothing do_nothing
                      (lambda (@rest _args)
                        (setq print_button_cb print_hello_world)
                        (setf (dynamic custom_form)->print_button->enabled t)
                        ))
                    ));wait_button
                ));main_layout
            ?buttonLayout 'Close
            )))
    
      );closure
    );SKILL++

    Hope This Helps
    Cheers,
    Aurélien

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information