• 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. how to set the "dontBlock" attribute value of a LayoutF...

Stats

  • Locked Locked
  • Replies 7
  • Subscribers 143
  • Views 2277
  • 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

how to set the "dontBlock" attribute value of a LayoutForm

JamesJames
JamesJames over 1 year ago

Hi All,

I'm trying to convert a form create function from hiCreateAppForm to hiCreateLayoutForm, because I cann't stand calculate the coordinates of all widgets in that form to layout them.

The history code about hiCreateAppForm set the attribute of a form "?dontBlock t" , which can be used to do some clear work and relase resource after form is closed in a procedure function, I attach the example code as follow. I'm trying to set the similar attribute in hiCreateLayoutForm, I only get the "?dialogStyle ’modal" is likely "?dontBlock", which is too aggressive to block user to access/control the others form.

So I want to know that is there an attribute to achieve block the form and also allow user tocontrol/access the others form at the same time.

procedure(test1()
  let((lb1 bt1)
    lb1 = hiCreateLabel(
      ?name 'lb1
      ?labelText "<b style='color:#cc0000;'>labelText1</b>"
    )
   
    bt1 = hiCreateButton(
      ?name 'bt1
      ?buttonText "bt1"
    )
    form1 = hiCreateAppForm(
      ?name 'form1
      ?fields list(
        list(lb1 5:5 100:30)
        list(bt1 5:35 100:30)
      )
      ?dontBlock nil

    )

    hiDisplayForm(form1)

    ;clean work
    printf("Here: do some clear work and release some resources\n")
  )
)

test1()
;=======================================
procedure(test2()
  let((lb2 bt2)
    lb2 = hiCreateLabel(
      ?name 'lb2
      ?labelText "<b style='color:#cc0000;'>labelText2</b>"
    )
   
    bt2 = hiCreateButton(
      ?name 'bt2
      ?buttonText "bt2"
    )
    form2 = hiCreateLayoutForm(
      'form2
      "Test LayoutForm"
      hiCreateVerticalBoxLayout(
        'form2VBox
        ?items list(
          lb2
          bt2
        )
      )
      ?dialogStyle 'modal

    )

    hiDisplayForm(form2)

    ;clean work
    printf("Here: do some clear work and release some resources\n")
  )
)

test2()
  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 1 year ago

    You do not need to set this. Layout forms are always non-blocking (i.e. hiDisplayForm returns immediately), whereas App forms were blocking by default and ?dontBlock t made them non-blocking. I can't see why you would use ?dialogStyle 'modal on just the layout form - that makes it modal which means that that everything is held until the form is OK'd and is effectively a way of making it block - which is the opposite of what ?dontBlock t does.

    So in other words, Layout forms are already like creating an App form with ?dontBlock t without you needing to do anything.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • JamesJames
    JamesJames over 1 year ago in reply to Andrew Beckett

    Thanks Andrew, Actually I want to set the layoutFrom like "?dontBlock nil", sorry for that unclear describtion.

    If I set the LayoutForm to block  that I don't need to modify the "clear work code"

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 1 year ago in reply to JamesJames

    There's no supported mechanism to make layout forms blocking. In general, forms (even app forms) should be implemented to do any subsequent work in the ?callback function of the form rather than relying on the blocking nature of the form. For a start, this is needed for the Apply button to work on the form.

    Why do you need the form to be blocking? There might be an alternative solution depending on the reason...

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • JamesJames
    JamesJames over 1 year ago in reply to Andrew Beckett

    Thanks for your replying, Andrew.

    In a history project, the history code is trying to release some ipc process, reset some filed to default value and reset some global variable to nil,and also delete some forms that include "hiDeleteFrom(this_main_form)", those important actions relys on "?dontBlock t" currently.

    But the code about those actions are too much that need to much effort to make sure that the behvaior keep same as I modified before.

    Thanks,

    James 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 1 year ago in reply to JamesJames

    You could easily convert the cleanup work into a callback without having to restructure the code too much:

    ; this macro creates a callback for a form (which doesn't have one) which 
    ; only gets called on OK and Cancel (not Apply). It works by creating a 
    ; temporary function, which is used for both the OK and Cancel callbacks
    defmacro(CCFcreateOKandCancelCB (form @rest body)
      let(((formVar gensym('formVar)) (cbVar gensym('cbVar)))
        `hiChangeFormCallback(
          ,form
          let(((,cbVar lambda((,formVar) unless(hiIsFormDisplayed(,formVar) ,@body))))
            list(,cbVar ,cbVar)
          )
        )
      )
    )
        
    procedure(test2()
      let((lb2 bt2)
        lb2 = hiCreateLabel(
          ?name 'lb2
          ?labelText "<b style='color:#cc0000;'>labelText2</b>"
        )
       
        bt2 = hiCreateButton(
          ?name 'bt2
          ?buttonText "bt2"
        )
        form2 = hiCreateLayoutForm(
          'form2
          "Test LayoutForm"
          hiCreateVerticalBoxLayout(
            'form2VBox
            ?items list(
              lb2
              bt2
            )
          )
          ?dialogStyle 'modal
    
        )
    
        ;clean work
        CCFcreateOKandCancelCB(form2 
          printf("Here: do some clear work and release some resources\n")
          ; can't delete the same form within it's own callback, so enqueue
          ; instead
          hiEnqueueCmd("hiDeleteForm(form2)")
        )
    
        hiDisplayForm(form2)
      )
    )
    

    I have a macro created to simply the creation of the anonymous function, and also to include the checks so that it only gets called when the form is no longer displayed (to prevent the Apply button from doing anything). I also use hiEnqueueCmd to delete the form because you can't delete a form within its own callback.

    Might help...

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 1 year ago in reply to Andrew Beckett

    You could easily convert the cleanup work into a callback without having to restructure the code too much:

    ; this macro creates a callback for a form (which doesn't have one) which 
    ; only gets called on OK and Cancel (not Apply). It works by creating a 
    ; temporary function, which is used for both the OK and Cancel callbacks
    defmacro(CCFcreateOKandCancelCB (form @rest body)
      let(((formVar gensym('formVar)) (cbVar gensym('cbVar)))
        `hiChangeFormCallback(
          ,form
          let(((,cbVar lambda((,formVar) unless(hiIsFormDisplayed(,formVar) ,@body))))
            list(,cbVar ,cbVar)
          )
        )
      )
    )
        
    procedure(test2()
      let((lb2 bt2)
        lb2 = hiCreateLabel(
          ?name 'lb2
          ?labelText "<b style='color:#cc0000;'>labelText2</b>"
        )
       
        bt2 = hiCreateButton(
          ?name 'bt2
          ?buttonText "bt2"
        )
        form2 = hiCreateLayoutForm(
          'form2
          "Test LayoutForm"
          hiCreateVerticalBoxLayout(
            'form2VBox
            ?items list(
              lb2
              bt2
            )
          )
          ?dialogStyle 'modal
    
        )
    
        ;clean work
        CCFcreateOKandCancelCB(form2 
          printf("Here: do some clear work and release some resources\n")
          ; can't delete the same form within it's own callback, so enqueue
          ; instead
          hiEnqueueCmd("hiDeleteForm(form2)")
        )
    
        hiDisplayForm(form2)
      )
    )
    

    I have a macro created to simply the creation of the anonymous function, and also to include the checks so that it only gets called when the form is no longer displayed (to prevent the Apply button from doing anything). I also use hiEnqueueCmd to delete the form because you can't delete a form within its own callback.

    Might help...

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 1 year ago in reply to Andrew Beckett

    If the code that was following the hiDisplayForm needs to access local variables within the same function, you might want to consider moving the code to a file with a .ils suffix so that that the lambda that's created can see the variables in the same lexical scope.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 1 year ago in reply to Andrew Beckett

    If the code that was following the hiDisplayForm needs to access local variables within the same function, you might want to consider moving the code to a file with a .ils suffix so that that the lambda that's created can see the variables in the same lexical scope.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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