• 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. Call a function after the user has selected something in...

Stats

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

Call a function after the user has selected something in the schematic editor

PatrikOsgnach
PatrikOsgnach over 9 years ago

Hello,

I have a simple matter to solve. I would like to have a function called when the user selects something in the schematic editor.
In particular, whenever the user click on a wire, I'd like to call a function f(wire) that does something with the wire label.

How can I do this? I didn't find anything suitable in the function trigger names table.

BTW, is it possible to have a function called when the user closes a tab or clicks on edit->hierarchy->return menu item?

Thank you.

  • Cancel
  • skillUser
    skillUser over 9 years ago

    Hi Patrik,

    To my knowledge the best way to do this would be to modify the Left-Click mouse bindkey so that it calls a function as well or instead of the default schSingleSelectPt().  Here's a brief example of what I am suggesting:

    procedure(myFun()
      let( ((obj car(geGetSelSet())))
        when(obj~>objType=="line"
          println(obj~>net~>name)
        ); when
      ); let
    ); procedure
    hiSetBindKey("Schematics" "None" "schSingleSelectPt() myFun()")

    Now whenever a wire object is clicked directly (i.e. not drag-selected, for example), the wire name would be printed out in the CIW.

    I'm not sure if there is a trigger for switching tabs (I presume that you mean design window tabs, e.g. in a schematic editor window). There may be a trigger for returning (perhaps related to dePop() ?) or you might redefine the Ctrl-E bindkey (and menu item) to run your own function in addition to, or as a wrapper around the schHiReturn() function.

    Hope this helps.

    Regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • PatrikOsgnach
    PatrikOsgnach over 9 years ago

    Hello Lawrence,

    thank you, I'll try your solution.

    Essentially I have to do two things:

    1) keep track of a "descent hierarchy". When the user opens the first schematic, push the cell name on a stack. When the user descends into a subcell with the descend command (which opens the cell in a new tab or in the current one), push the name of the cell on the stack. When the user returns (with the return command, with Ctrl+E or by closing the tab), pop the last cell name from the stack.

    I have solved this by using the deRegUserTrigger function to call a function when the schematic editor is opened. If the current cell name is already in the second-from-top position on the stack, it means that the user has returned and I'll just pop the top of the stack. Otherwise, I push the cell name. It works fine, but I was wondering if there is a cleaner solution.

    2) I need to keep an history of clicked wires names (click alone, not click and drag). When the user click on a wire, add the name to the list. When there are 2 names on the list, do some processing and the do what would have been done after an ordinary click

    Best regards,

    Patrik

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 9 years ago

    Patrik,

    In the trigger function, you get told (via the disembodied property list passed in) what action was taken - whether it was a push or a pop (I forget the action names) - it's args->action if I remember rightly. Plus you can always call one of these functions:

    geGetHierMemInst(
    [ w_windowId ]
    )
    => l_list / nil
    Returns a list describing the hierarchy of instances that have been descended into or edited-in-place to arrive at the cellview in the window.

    geGetInstHier(
    [ w_windowId ]
    )
    => t_instance-hierarchy / nil
    Returns a string describing the hierarchy of instances that have been descended into or edited-in-place in the current window to arrive at the cellview in the window.

    geGetInstHierPath(
    w_windowId
    )
    => l_instance-hierarchy / nil
    Similar to geGetInstHier but returns additional information for mosaic instances.

    This function returns a list of list describing the hierarchy of instances that have been descended into or edited-in-place in the current window to arrive at the cellview in the window. The list contains the following information for each instance:

    (dbinst memInst row column)

    to tell you the current hierarchy location (so the system keeps track of the stack - you don't have to do it yourself).

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • PatrikOsgnach
    PatrikOsgnach over 9 years ago

    Hello Andrew,

    thank you, geGetHierMemInst does what I need.

    Do you know if these is a way to create a "spreadsheet" ? Regarding the second think I need to do, I want that, every time the user clicks on two wires, their names are added to the spreadsheet (essentially, two columns and n rows). I was thinking of using a two list boxes but they are scrollable independently. If I am looking at element 34 on the first list box, element 34 of the second list box must be at the same position on screen.

    Maybe I could use hiCreateReportField

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 9 years ago
    Yes, hiCreateReportField will do what you want. The main limitation of that is that you can't have type-in entries in the report field (there's no public "hi" widget that provides that).
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • PatrikOsgnach
    PatrikOsgnach over 9 years ago
    Ok, that should not be a problem, as the entries are not supposed to be modifiable. Is there an easy way to allow the user to delete a row from the report field?
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 9 years ago

    You could add a context menu (Right Mouse Button menu) over the field and that could be used to remove the row. There is info on adding context menus in the documentation (i.e. cdnshelp).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • PatrikOsgnach
    PatrikOsgnach over 9 years ago
    Right. Good advice. I just hat to set the hiContextMenu field of the report field. Thank you
    • 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