• 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. Possible or not to highlight text in UI?

Stats

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

Possible or not to highlight text in UI?

Keii
Keii over 8 years ago

Hello All,

A little background about my question.

A co-worker has helped with creating a special MV script which has a UI that allows me to enter (x,y) coordinates to move the selected object by whatever I input. The only thing I don't like about it is that when I execute the command I have to first delete the default value (0,0) in the UI. For now I have created a macro on my gaming mouse that does a Ctrl+A then executes the special MV command, but I would like anyone to be able to use this. 

The question:

I don't know if this would be simple or not, but is there a way to have the value highlighted as soon as the UI pops up so that I can immediately type the coordinates?

Here is the script:

moveToXYValue = list(0 0)
procedure(moveToXY()
let(()

pointsField = hiCreatePointField(
                ?name 'pointsField
                ?prompt "Enter Point"
                ?value moveToXYValue
                )
form=hiCreateAppForm(
        ?name 'form
        ?fields list( list(pointsField 0:0 200:20 100))
        ?callback 'moveCallback
        )
hiDisplayForm(form)
)
)

procedure(moveCallback(one)
let(()
        xy = one->pointsField->value
        moveToXYValue=xy
        ;leZoomToPoint(geGetEditCellViewWindow(geGetEditCellView()) xy )
        mv(car(xy) nth(1 xy))
)
)
hiSetBindKey("Layout" "<key>m" "moveToXY()")

procedure(mv(@optional dx dy)
let((fig cv)
        if((dx== nil || dy == nil) then
                println("mv : Moves the selected element by x and y")
                println("USAGE: mv(x_move y_move)")
        else
                foreach(fig geGetSelectedSet()
                        if(fig~>objType != "textDisplay" &&  fig~>objType != "label"  then
                                println(fig~>objType)
                                cv =fig~>cellView
                                if(geIsFigPartiallySelected(fig) then
                                        leStretchShape(fig dx:dy geGetSelSetFigPoint(fig))
                                else
                                        dbMoveFig(fig cv list(dx:dy "R0"))
                                );if
                        );if
                );foreach
        );if
        nil
);let
);provedure mv

Thanks,

Keith

  • Cancel
  • skillUser
    skillUser over 8 years ago

    Hi Keith,

    I think that you can just build the field with no default value (empty) and since it is the only field on the form, I think it already has focus, but you may need to move the mouse over the form, depending on your window manager.  Here's the modified code:

    
    procedure(moveToXY()
      let((pointsField form)
        pointsField = hiCreatePointField(
    	    ?name 'pointsField
    	    ?prompt "Enter Point"
    ;;	    ?value moveToXYValue
        )
        form=hiCreateAppForm(
    	    ?name 'moveToXYForm
    	    ?formTitle "Move To XY"
    	    ?fields list( list(pointsField 0:0 200:20 100))
    	    ?callback 'moveCallback
        )
        hiDisplayForm(form)
      )
    )
    

    Try it out.  Good luck.

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Keii
    Keii over 8 years ago
    Thanks Lawrence, I forgot to mention a portion of the script (the part that you removed) was to remember the last value entered. You are right, if I didn't have the memory part of the script then it would work for what I asked. The second part of the script that redefines the "mv" function is there so if I partially select an object it does a "stretch" command instead of a "mv".
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 8 years ago

    Hi Keith,

    Ok, for that to work (automatically) don't redefine the form each time:

    
    procedure(moveToXY()
      let((pointsField form)
        if(boundp('moveToXYForm) && hiIsForm(moveToXYForm) then
          form = moveToXYForm
        else
          pointsField = hiCreatePointField(
    	    ?name 'pointsField
    	    ?prompt "Enter Point"
          )
          form=hiCreateAppForm(
    	    ?name 'moveToXYForm
    	    ?formTitle "Move To XY"
    	    ?fields list( list(pointsField 0:0 200:20 100))
    	    ?callback 'moveCallback
          )
        ); if
        hiDisplayForm(form)
      ); let
    ); procedure moveToXY
    

    Best regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Keii
    Keii over 8 years ago

    skillUser said:

    Hi Keith,

    Ok, for that to work (automatically) don't redefine the form each time:

    
    procedure(moveToXY()
      let((pointsField form)
        if(boundp('moveToXYForm) && hiIsForm(moveToXYForm) then
          form = moveToXYForm
        else
          pointsField = hiCreatePointField(
    	    ?name 'pointsField
    	    ?prompt "Enter Point"
          )
          form=hiCreateAppForm(
    	    ?name 'moveToXYForm
    	    ?formTitle "Move To XY"
    	    ?fields list( list(pointsField 0:0 200:20 100))
    	    ?callback 'moveCallback
          )
        ); if
        hiDisplayForm(form)
      ); let
    ); procedure moveToXY
    

    Best regards,

    Lawrence.

    This worked exactly the way I needed it to! Thank so much Lawrence!

    -Keith

    • 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