• 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 automatically select the content of a field when...

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 143
  • Views 15937
  • 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 automatically select the content of a field when a form appears?

iDave
iDave over 7 years ago

Hi all,

 I have create a form using hiCreateAppForm(), and when the form was invoked, the cursor will automatically focus on the first editable field, but will not select the content of that field.

I want to make the select automatically, so I can change the content directly by using keyboard. Is there any ways to implement it?

Another question: Is there any ways to remove the “Help” button from the form?

Regards,

Dave

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 7 years ago

    I think if you just set the field with hiSetCurrentField:

    hiSetCurrentField(myform 'f1)

    Then it makes that the focus field, but also selects the content when it's displayed. Just to double check, which IC subversion are you using (Help->About in the CIW will tell you)?

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • iDave
    iDave over 7 years ago in reply to Andrew Beckett

    Thanks Andrew,

     I’m using the IC617isr15, And I have tried the function hiSetCurrentField(), but it seems doesn’t work well at all times . Below is my major script, could you please help me to find the problem, thanks!

    procedure(myDisplayForm()

        one = hiCreateIntField(?name ‘one

            ?prompt “test number”

            ?value 1)

      ;two = ...

        hiCreateAppForm(?name ‘myForm

            ?prompt “My Form”

            ?fields list(one)

            ?button ‘OKCancel)

        hiDisplayForm(myForm)

        hiSetCurrentField(myForm ‘one)

    )

    Type in myDisplayForm() in CIW.

    Regards,

    Dave

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago in reply to iDave

    The code didn't quite work because the arguments to hiCreateAppForm are incorrect. I tried a number of things, and I think you can't do it when the form is created. You can however do it on subsequent calls to hiDisplayForm - so if you're displaying an existing form which is not being recreated.

    I tried using hiInstantiateForm beforehand, setting hiSetCurrentField before displaying the form (it makes no sense to do it after the display as you have, since hiDisplayForm will block by default). I even tried enqueueing the commands and adding a display, cancel and re-display to see if that helped (it didn't).

    procedure(myDisplayForm()
    
        one = hiCreateIntField(?name 'one
            ?prompt "test number"
            ?value 1)
    
      ;two = ...
    
        hiCreateAppForm(?name 'myForm
            ?formTitle "My Form"
            ?fields list(one)
            ?buttonLayout 'OKCancel)
    
        hiSetCurrentField(myForm 'one)
        hiEnqueueCmd("hiDisplayForm(myForm)")
        hiEnqueueCmd("hiFormCancel(myForm)")
        hiEnqueueCmd("hiDisplayForm(myForm)")
    
    )

    So you probably will need to contact customer support and ask for an enhancement to support this.

    On subsequent calls, I can just do:

    hiSetCurrentField(myForm 'one)
    hiDisplayForm(myForm)

    and then it seems to work (actually the set current field isn't really needed, since I only have one field).

    I didn't answer your other question in your original post about not having the Help button. I don't think you can remove it, but you could add:

       ?buttonDisabled list('Help))

    to the hiCreateAppForm call. This will at least grey out the Help button.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • iDave
    iDave over 7 years ago in reply to Andrew Beckett

    Hi Andrew,

    Thanks a lot for your kindly response and what you did. 

    I tried to use the subsequent calls as you said, and it works. But since I integrated the form to a pulldown menu, it meet another problem.

    Assuming  I have opened two layout cell which named layoutA and layoutB, and launch a form in LayoutA, then I get a formA, Now launch a form in layoutB, my desire is get a formB that is different from formA, but actually the shown form is still formA. How can I get a new form for every different layout cell?

    Let me show you the complete code. 

    procedure(myDisqplayForm()

    let((one two)

       one = hiCreateIntField(?name 'one

           ?prompt "first number"

           ?value 1)

     two = hiCreateFloatField(?name ‘two        

           ?prompt “second number”      

           ?value 1.5)

       hiCreateAppForm(?name 'myForm

           ?formTitle "My Form"

           ?fields list(one two)

           ?buttonLayout 'OKCancel        

           ?callback “println(cv) printf(“%n %n\n” myForm->one->value myForm->two->value))

           ?mapCB   “cv=hiGetEditCellView()”

    )

    myForm

    )  

    myDisqplayForm()

        hiSetCurrentField(myForm ‘one)    

    procedure(myMenu(args)

       let((cw menu1)

            cw=hiGetCurrentWindow()  

          menu1=hiCreateMenuItem(

                ?name ‘menu1

                ?itemText “menu A”

                ?callback “hiDisplayForm(myForm)”)     

        allMenuID=hiCreatePulldownMenu(  

              ‘allMenuID

                “All Menu”

                list(menu1))    

        hiInsertBannerMenu(cw allMenuID 0)  

          list(menu1) ))  

    deRegUserTriggers(“maskLayout” nil ‘myMenu)    

    Looking  forward to your reply. 

    Regards,

    Dave

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 7 years ago in reply to iDave

    Dave,

    I altered the code a bit to show how to do it:

    procedure(myCreateForm(lib cell view)
       let((one two myForm)
          one = hiCreateIntField(?name 'one
             ?prompt "first number"
             ?value 1
          )
          two = hiCreateFloatField(?name 'two        
             ?prompt "second number"      
             ?value 1.5
          )
          ; create a unique form per cellView
          hiCreateAppForm(?name concat('myForm lib cell view)
             ?formTitle "My Form"
             ?fields list(one two)
             ?buttonLayout 'OKCancel        
             ?callback "println(hiGetCurrentForm()->cv) printf(\"%n %n\n\" hiGetCurrentForm()->one->value hiGetCurrentForm()->two->value)"
          )
       )
       myForm
    )  
    
    procedure(myDisplayForm(@optional (cv geGetEditCellView()))
       let((myFormName myForm)
           myFormName=concat('myForm cv->libName cv->cellName cv->viewName)
           myForm=symeval(myFormName)
           hiSetCurrentField(myForm 'one)    
           ; store the cellView id on the form to make it easier to obtain in
           ; the callback (i.e. it's set when the form is displayed, not when
           ; callback is invoked).
           myForm->cv=cv
           hiDisplayForm(myForm)
       )
    )
    
    procedure(myMenu(args)
       let((menu1 myFormName)
          myFormName=concat('myForm args->libName args->cellName args->viewName)
          unless(boundp(myFormName)
             myCreateForm(args->libName args->cellName args->viewName)
          )
    
          menu1=hiCreateMenuItem(
                ?name 'menu1
                ?itemText "menu A"
                ?callback "myDisplayForm()"
          )     
          allMenuID=hiCreatePulldownMenu(  
              'allMenuID
              "All Menu"
              list(menu1)
          )    
          ; do not insert the banner menu - return a list of
          ; menus
          ;hiInsertBannerMenu(cw allMenuID 0)  
          list(allMenuID) 
       )
    )  
    
    deRegUserTriggers("maskLayout" nil 'myMenu)
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • iDave
    iDave over 7 years ago in reply to Andrew Beckett

    Thank you, Andrew.

     I will test the code at next Monday, have a  nice weekend to you. 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • iDave
    iDave over 7 years ago in reply to Andrew Beckett

    Thank you, Andrew.

     I will test the code at next Monday, have a  nice weekend 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