Home
  • Products
  • Solutions
  • Support
  • Company

This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  • Products
  • Solutions
  • Support
  • Company
Community Custom IC SKILL How to access the value of a boolean button within a form...

Stats

  • Locked Locked
  • Replies 20
  • Subscribers 136
  • Views 7673
  • 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 access the value of a boolean button within a form within a docked window

blankman
blankman over 1 year ago

Hi,

I have a form, within a docked window, within my session window. And within that form I have a boolean button. How do I access the value of that boolean button?

I have tried this, however is not accessing it:

hiGetCurrentForm()~>bool1~>value

Thanks,

B

  • Cancel
Parents
  • blankman
    blankman over 1 year ago

    PS, the dock window was created using code provided by AurelBuche (at the following location). ie the dock window was added to a global table.

    community.cadence.com/.../1395442

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

    You can't use hiGetCurrentForm() with forms in dock windows - see this post. Are you trying to access this within a callback - if so that post will give you a suggestion, hopefully.

    Andrew

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

    Andrew, Ok, see updated below adding button to DockForm, this new button functions differently depending on the state of bool1. Thanks, B

    [EDIT: code removed]

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

    I changed the button callback to be the name of the function (it could have been a local function or a lambda, but I didn't want to confuse you with understanding lexical scoping and SKILL++), and in that case it receives information about the field and the scope (the form in this case). Because of this, it will get the form for the specific window you're in - and thus will work. I'm not sure why you need to set a global variable "Test" in your callback (that said your code is lacking let() functions across the board and is not being careful to declare local variables). This part of the code is what I changed (other than indenting to make the code a bit clearer):

    ; used by app_create_dwin(swin)
    procedure(DockFormProc()
      button1=hiCreateButton(
        ?name 'button1
        ?buttonText "Ticked/Unticked?"
        ; pass the name of the function so that it gets called
        ; as a "function object callback" (search in docs for that
        ; string)
        ?callback 'UseBoolTest
      )
      bool1 = hiCreateBooleanButton(
        ?name 'bool1
        ?buttonText " "
        ?buttonLocation 'right
      )
      DockForm=hiCreateAppForm(
        ?name gensym('DockFormApp)
        ?formTitle "Test"
        ?fields
        list( list(button1 0:3 165:18)
          list(bool1 86:25 15:2 25)
        )
      )
      DockForm
    )
    
    ;---------------------------------------------
    
    ;target proc that I intend to use the value of the boolean button in.
    ; for buttons, these only have two arguments (no value)
    procedure(UseBoolTest(field form)
      Test = nil
      if(form->bool1->value == nil 
        then Test = "a"
          printf("Button is unticked\n")
        else Test = "b"
          printf("Button is ticked\n")
      )
    )
    

    Regards,

    Andrew

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

    Thanks Andrew, works perfectly, yes I had removed much of the finer details (let statements etc) for the test case. Appreciate the support, very helpful, thanks, B

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

    Hi Andrew, another quick question, say I want to add this proc UseBoolTest to a bindkey, what should I pass for variables field and form in the below code? See error I am seeing following. K Rgds, B

    hiSetBindKey("Layout" "1" "UseBoolTest()")

    *Error* BRSADI11Oct2023EnableMetals123: too few arguments (2 expected, 0 given) - nil

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

    If you add this function to your code (or something like it):

    procedure(CCFfindAssistant(assistantName @optional 
        (swin hiGetSessionWindow(hiGetCurrentWindow())))
      car(
        exists(
          assistant 
          setof(dwin hiGetWindowList('dockable) 
            hiGetSessionWindow(dwin)==swin && hiGetWindowState(dwin)=='mapped)
          hiGetWindowName(assistant)==assistantName
        )
      )
    )

    Then you can set your bindkey to be:

    hiSetBindKey("Layout" "1" "UseBoolTest('button1 symeval(CCFfindAssistant(\"Test\")->hiForm))")

    The idea is that CCFfindAssistant looks for an assistant which is associated with the current session window and is mapped (so it's visible) which has the window name matching the given argument (this is the "title" of your docked window). Having found that, it then gets the symbol associated with the form in that docked window and evaluates it to get the form handle - and then passes the two arguments to your UseBoolTest function. The first argument is just the name of the field but since your callback is  not using the field name it probably doesn't matter.

    Regards,

    Andrew

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

    Thanks Andrew, this works, and yes the first argument is not showing to matter on my side, as I have just set this up across multiple different bindkeys that use multiple different buttons, and it still works. Thank again, B

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

    Andrew, I am seeing some unexpected behaviour using the bindkey allocation. After a period of time of successful use I get the following error and the bindkey stops working.

    *Error* symeval: argument #1 should be a symbol (type template = "se") - nil

    Though I notice when I again call the UseBoolTest proc directly (by clicking button1 within DockForm) the bindkey again begins to function correctly. I cannot see what might be causing this. Any ideas what might be happening here?

    K Rgds, B

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

    The only reason I can think of is that CCFfindAssistant is not finding the assistant (for some reason) and is returning nil. I don't know why that would happen - I might try doing:

    trace(CCFfindAssistant hiGetWindowState hiGetWindowName hiGetSessionWindow)

    to see if that gives any clues when it's failing. Might be a bit noisy in normal use - but it might give some clues as to what is going on.

    Andrew

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

    Thanks Andrew, here is what I see from CIW when I try and use the bindkey, when the bindkey is not functional with aforementioned error. Is this what you are looking for? Rgds, B

    |[1]CCFfindAssistant("Test")
    |[2]hiGetSessionWindow(window:12)
    |[2]hiGetSessionWindow --> swindow:11
    |[2]hiGetSessionWindow(dwindow:1)
    |[2]hiGetSessionWindow --> swindow:1
    |[2]hiGetSessionWindow(dwindow:2)
    |[2]hiGetSessionWindow --> swindow:1
    |[2]hiGetSessionWindow(dwindow:3)
    |[2]hiGetSessionWindow --> swindow:1
    |[2]hiGetSessionWindow(dwindow:4)
    |[2]hiGetSessionWindow --> swindow:1
    |[2]hiGetSessionWindow(dwindow:5)
    |[2]hiGetSessionWindow --> swindow:1
    |[2]hiGetSessionWindow(dwindow:6)
    |[2]hiGetSessionWindow --> swindow:1
    |[2]hiGetSessionWindow(dwindow:7)
    |[2]hiGetSessionWindow --> swindow:1
    |[2]hiGetSessionWindow(dwindow:8)
    |[2]hiGetSessionWindow --> swindow:1
    |[2]hiGetSessionWindow(dwindow:9)
    |[2]hiGetSessionWindow --> swindow:1
    |[2]hiGetSessionWindow(dwindow:10)
    |[2]hiGetSessionWindow --> swindow:1
    |[2]hiGetSessionWindow(dwindow:11)
    |[2]hiGetSessionWindow --> swindow:1
    |[2]hiGetSessionWindow(dwindow:85)
    |[2]hiGetSessionWindow --> swindow:9
    |[2]hiGetSessionWindow(dwindow:86)
    |[2]hiGetSessionWindow --> swindow:9
    |[2]hiGetSessionWindow(dwindow:87)
    |[2]hiGetSessionWindow --> swindow:9
    |[2]hiGetSessionWindow(dwindow:88)
    |[2]hiGetSessionWindow --> swindow:9
    |[2]hiGetSessionWindow(dwindow:89)
    |[2]hiGetSessionWindow --> swindow:9
    |[2]hiGetSessionWindow(dwindow:90)
    |[2]hiGetSessionWindow --> swindow:9
    |[2]hiGetSessionWindow(dwindow:91)
    |[2]hiGetSessionWindow --> swindow:9
    |[2]hiGetSessionWindow(dwindow:92)
    |[2]hiGetSessionWindow --> swindow:9
    |[2]hiGetSessionWindow(dwindow:93)
    |[2]hiGetSessionWindow --> swindow:9
    |[2]hiGetSessionWindow(dwindow:94)
    |[2]hiGetSessionWindow --> swindow:9
    |[2]hiGetSessionWindow(dwindow:95)
    |[2]hiGetSessionWindow --> swindow:9
    |[2]hiGetSessionWindow(dwindow:96)
    |[2]hiGetSessionWindow --> swindow:9
    |[2]hiGetSessionWindow(dwindow:97)
    |[2]hiGetSessionWindow --> swindow:1
    |[2]hiGetSessionWindow(dwindow:98)
    |[2]hiGetSessionWindow --> swindow:10
    |[2]hiGetSessionWindow(dwindow:99)
    |[2]hiGetSessionWindow --> swindow:10
    |[2]hiGetSessionWindow(dwindow:100)
    |[2]hiGetSessionWindow --> swindow:10
    |[2]hiGetSessionWindow(dwindow:101)
    |[2]hiGetSessionWindow --> swindow:10
    |[2]hiGetSessionWindow(dwindow:102)
    |[2]hiGetSessionWindow --> swindow:10
    |[2]hiGetSessionWindow(dwindow:103)
    |[2]hiGetSessionWindow --> swindow:10
    |[2]hiGetSessionWindow(dwindow:104)
    |[2]hiGetSessionWindow --> swindow:11
    |[2]hiGetWindowState(dwindow:104)
    |[2]hiGetWindowState --> unmapped
    |[2]hiGetSessionWindow(dwindow:105)
    |[2]hiGetSessionWindow --> swindow:11
    |[2]hiGetWindowState(dwindow:105)
    |[2]hiGetWindowState --> unmapped
    |[2]hiGetSessionWindow(dwindow:106)
    |[2]hiGetSessionWindow --> swindow:11
    |[2]hiGetWindowState(dwindow:106)
    |[2]hiGetWindowState --> unmapped
    |[2]hiGetSessionWindow(dwindow:107)
    |[2]hiGetSessionWindow --> swindow:11
    |[2]hiGetWindowState(dwindow:107)
    |[2]hiGetWindowState --> unmapped
    |[2]hiGetSessionWindow(dwindow:108)
    |[2]hiGetSessionWindow --> swindow:11
    |[2]hiGetWindowState(dwindow:108)
    |[2]hiGetWindowState --> unmapped
    |[2]hiGetSessionWindow(dwindow:109)
    |[2]hiGetSessionWindow --> swindow:11
    |[2]hiGetWindowState(dwindow:109)
    |[2]hiGetWindowState --> mapped
    |[2]hiGetSessionWindow(dwindow:110)
    |[2]hiGetSessionWindow --> swindow:11
    |[2]hiGetWindowState(dwindow:110)
    |[2]hiGetWindowState --> mapped
    |[2]hiGetSessionWindow(dwindow:111)
    |[2]hiGetSessionWindow --> swindow:11
    |[2]hiGetWindowState(dwindow:111)
    |[2]hiGetWindowState --> unmapped
    |[2]hiGetSessionWindow(dwindow:112)
    |[2]hiGetSessionWindow --> swindow:11
    |[2]hiGetWindowState(dwindow:112)
    |[2]hiGetWindowState --> mapped
    |[2]hiGetSessionWindow(dwindow:113)
    |[2]hiGetSessionWindow --> swindow:11
    |[2]hiGetWindowState(dwindow:113)
    |[2]hiGetWindowState --> unmapped
    |[2]hiGetSessionWindow(dwindow:114)
    |[2]hiGetSessionWindow --> swindow:11
    |[2]hiGetWindowState(dwindow:114)
    |[2]hiGetWindowState --> unmapped
    |[2]hiGetSessionWindow(dwindow:126)
    |[2]hiGetSessionWindow --> swindow:13
    |[2]hiGetSessionWindow(dwindow:127)
    |[2]hiGetSessionWindow --> swindow:13
    |[2]hiGetSessionWindow(dwindow:128)
    |[2]hiGetSessionWindow --> swindow:13
    |[2]hiGetSessionWindow(dwindow:129)
    |[2]hiGetSessionWindow --> swindow:13
    |[2]hiGetSessionWindow(dwindow:130)
    |[2]hiGetSessionWindow --> swindow:13
    |[2]hiGetSessionWindow(dwindow:131)
    |[2]hiGetSessionWindow --> swindow:13
    |[2]hiGetWindowName(dwindow:109)
    |[2]hiGetWindowName --> "Property Editor"
    |[2]hiGetWindowName(dwindow:110)
    |[2]hiGetWindowName --> "Palette"
    |[2]hiGetWindowName(dwindow:112)
    |[2]hiGetWindowName --> "Navigator"
    |[1]CCFfindAssistant --> nil
    *Error* symeval: argument #1 should be a symbol (type template = "se") - nil
    |[2]hiGetWindowState(...)
    |[2]hiGetWindowState --> ...
    |[4]hiGetWindowState(...)
    |[4]hiGetWindowState --> ...
    |[2]hiGetWindowState(...)
    |[2]hiGetWindowState --> ...
    |[4]hiGetWindowState(...)
    |[4]hiGetWindowState --> ...
    |[2]hiGetWindowState(...)
    |[2]hiGetWindowState --> ...
    |[2]hiGetWindowState(...)
    |[2]hiGetWindowState --> ...
    |[4]hiGetWindowState(...)
    |[4]hiGetWindowState --> ...
    |[2]hiGetWindowState(...)
    |[2]hiGetWindowState --> ...
    |[3]hiGetSessionWindow(...)
    |[3]hiGetSessionWindow --> ...
    |[3]hiGetSessionWindow(...)
    |[3]hiGetSessionWindow --> ...
    |[4]hiGetSessionWindow(...)
    |[4]hiGetSessionWindow --> ...
    |[5]hiGetSessionWindow(...)
    |[5]hiGetSessionWindow --> ...
    |[3]hiGetSessionWindow(...)
    |[3]hiGetSessionWindow --> ...
    |[4]hiGetSessionWindow(...)
    |[4]hiGetSessionWindow --> ...
    |[5]hiGetSessionWindow(...)
    |[5]hiGetSessionWindow --> ...
    |[3]hiGetSessionWindow(...)
    |[3]hiGetSessionWindow --> ...
    |[4]hiGetSessionWindow(...)
    |[4]hiGetSessionWindow --> ...
    |[5]hiGetSessionWindow(...)
    |[5]hiGetSessionWindow --> ...

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

    Thanks Andrew, I am getting a long output from CIW. I had tried posting it here but it marked as spam. Is there any way I can get this to you?

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

    Thanks Andrew, I am getting a long output from CIW. I had tried posting it here but it marked as spam. Is there any way I can get this to you?

    • 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