• 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 change buttontext/icon

Stats

  • Locked Locked
  • Replies 11
  • Subscribers 143
  • Views 6294
  • 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 change buttontext/icon

mantis
mantis over 14 years ago

test1 = hiCreateButton(
             ?name 'test1
             ?buttonText "test button"
             ?callback "println(\"hello pressed\")"

)

I want to change buttonText to any other words.how ?

and I find I can't access the buttonText attribute through ~> operator, why?

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 14 years ago

    The way to do this is not via ~> but instead to use hiSetButtonLabel(test1 "Updated button") for example.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mantis
    mantis over 14 years ago

    thanks, it works.

    if I want to change the label of button by pressing this button. how I can get the instance name of this button.

    for example,

     test1 = hiCreateButton(
                 ?name 'addDevices
                 ?buttonText "test1"
                 ?callback "changebuttonname( )"

    procedure( changebuttonname()

                  hiSetButtonLabel( test1 "label")

    )

    I don't want it like this, I means,if these some proceduce like hiGet... to impliment it instead just input test1.

                

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

    Pass the field structure to the callback. For example:

     let((test1)
        test1 = hiCreateButton(
                 ?name 'addDevices
                 ?buttonText "test1"
                 ?callback "changebuttonname(hiGetCurrentForm()->addDevices)"
             )
        hiCreateAppForm(?name 'myForm ?fields list(test1))
    )

    procedure(changebuttonname(field)
        hiSetButtonLabel(field "label")
    )

    hiDisplayForm(myForm)

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mantis
    mantis over 14 years ago

    unfortunately, my buttons are define following, so I can't  get the button's name I press.

    for( i 0 9
       for( j 0 9
         sprintf( buttonname "button%d%d" i j)
         buttonarray[ i ][ j ] = hiCreateButton(
                                                ?name stringToSymbol( buttonname )
                                                ?buttonText buttonname
                                                ?callback "changebuttonlabel(hiGetCurrentForm()~>???)"
                                               )
    )
    so the problem go back to the start, I can't access the name attribute by ~>.

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

    Make the callback:

    ?callback sprintf(nil "changebuttonlabel(hiGetCurrentForm()->%s)" buttonname)

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mantis
    mantis over 14 years ago
    hi Andrew,

    attachment is a small skill program.
    the program is willing to create a button matrix, the matrix is dynamic, can be changed by type in  X or Y .
    the button label can be change to the name in the list box by pressing the button.
    I get two question,
    1. how can the list box be dynamic, I mean I can update the list element by change the strlist in the program.
    2. the button callback, callback should be a string,  how I can do other action when changing the button label.
    I can create a procedure, but the button label will not change correctly.

    what about your suggestion?

    following is a snapshot of the program.




    Regards,
    Tommi.
    MC_procedure.il
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 14 years ago

    Hi Tommi,

    Unfortunately there was no snapshot, and the code has bits missing (for example it doesn't contain the function to create the form, or add the getdy and getdx fields (assuming that's what they are). So it's really not obvious what exactly you're doing here, or what your questions are.

    For question 2, you can call any SKILL expression (or expressions - you can put more than one space-separated). There's no reason why you couldn't have a procedure that both changed the label and did something else. Or maybe I've not understood  you correctly (seeing a more complete example might make it obvious?)

    Can you post a self-contained bit of code that I don't have to guess what you're doing?

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mantis
    mantis over 14 years ago
    hi Andrew,
    here is my skill.
    /* define the button array */
    procedure( buttonareaArray( nRows nCols )
    let( ( rowArray row )
    declare( rowArray[ nRows ] )
    for(i 0 nRows-1
    declare( row[ nCols ] )
    rowArray[ i ] = row
    )
    rowArray
    )
    )

    /* change the button x y */
    procedure( change_form_x_y( )
    for(i (getdx~>value)+1 storeofx
    for(j 1 storeofy
    sprintf( buttonname "button%d%d" i j)
    hiDeleteField( MatchCreater stringToSymbol( buttonname ))
    )
    )
    for(i 1 storeofx
    for(j (getdy~>value)+1 storeofy
    sprintf( buttonname "button%d%d" i j)
    hiDeleteField( MatchCreater stringToSymbol( buttonname ))
    )
    )
    for(i storeofx+1 getdx~>value
    for(j 1 getdy~>value
    dnx=115+(i-1)*80
    dny=45+(j-1)*35
    buttonaddxlist = list( buttonarray[i][j] list(dnx dny) list(75 30) )
    hiAddField( MatchCreater buttonaddxlist )
    )
    )
    for(i 1 storeofx
    for(j storeofy+1 getdy~>value
    dnx=115+(i-1)*80
    dny=45+(j-1)*35
    buttonaddylist = list( buttonarray[i][j] list(dnx dny) list(75 30) )
    hiAddField( MatchCreater buttonaddylist )
    )
    )

    storeofx = getdx~>value
    printf( "%d" storeofx)
    storeofy = getdy~>value
    printf( "%d" storeofy)

    )

    /* initial the form coord */
    procedure( buttoncoordcal( buttoncoordlistorg getdx getdy )
    i = j = dx = dy = 0
    buttonWid = 75
    buttonHig = 30
    buttonPitchx = 80
    buttonPitchy = 35
    buttoncoordlist = buttoncoordlistorg
    for(i 1 getdx~>value
    for(j 1 getdy~>value
    dx=115+(i-1)*80
    dy=45+(j-1)*35
    button2dlist = list( buttonarray[i][j] list(dx dy) list(buttonWid buttonHig) )
    buttoncoordlist = append(buttoncoordlist cons( button2dlist nil ))
    )
    )
    buttoncoordlist
    )

    procedure( changelabel( field )
    listselectstatus = mylist~>value
    labeltoadd = nthelem(1 listselectstatus)
    hiSetButtonLabel(field labeltoadd)
    )



    /* create the button area */
    procedure( createbuttonarea( )
    for( i 0 29
    for( j 0 29
    sprintf( buttonname "button%d%d" i j)
    buttonarray[ i ][ j ] = hiCreateButton(
    ?name stringToSymbol( buttonname )
    ?buttonText buttonname
    ?callback sprintf(buttoncount "changelabel( hiGetCurrentForm()~>%s )" buttonname)
    )
    )
    )
    )



    strlist =list("aaa" "bbb" "ccc" "ddd" "eee" "fff")
    mylist = hiCreateListBoxField( ?name 'devicelist
    ?choices strlist
    ?callback "println(\"list changed\")"
    )
    listselectstatus = mylist~>value
    getdx = hiCreateIntField(
    ?name 'getintx
    ?prompt "X"
    ?value 3
    ?defValue 1
    ?format "%d"
    ?callback "change_form_x_y( )"
    ?range 0:100000
    )
    getdy = hiCreateIntField(
    ?name 'getinty
    ?prompt "Y"
    ?value 2
    ?defValue 1
    ?format "%d"
    ?callback "change_form_x_y( )"
    ?range 0:100000
    )
    buttoncoordlistorg = list(
    list( mylist 15:45 90:100 10 )
    list( getdx 15:5 55:30 10 )
    list( getdy 80:5 55:30 10 )
    )
    buttoncoordlist = list( )
    storeofx = getdx~>value
    storeofy = getdy~>value
    buttonarray = buttonareaArray( 30 30 )
    createbuttonarea
    buttoncoordcal( buttoncoordlistorg getdx getdy )
    change_form_x_y( )

    hiCreateAppForm( ?name 'MatchCreater
    ?formTitle "Match Creater"
    ?fields buttoncoordlist
    ?initialSize list( 500 500)
    ?callback ""
    ?help "formHelp" )
    hiSetFormPosition( 500:0)
    hiDisplayForm( MatchCreater )




    I think you can get all the script.
    Regards,
    Tommi
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 14 years ago

    Hi Tommi,

    To change the choices in the listbox, you'd do:

    MatchCreater->devicelist->choices='("x" "y" "z")

    etc. BTW, you have quite a few global variables in your code - I assume you wil tidy that up at some point. The only thing that really needs to be global is the variable containing the form, MatchCreater.

    I still don't understand what your second question was asking (maybe I answered it already?).

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • mantis
    mantis over 14 years ago

    yes, I have a lot of global variable there, I will tidy up them.

    I've get the two questions' answers.

    thanks a million.

    another question is, when I press the button to change the label,

    I will get the following message in CIW,

     *WARNING* Form 'MatchCreater', field 'button11': Bad value nil.

                         button icon must be a pixmap.

     what does the message warning for?

    • 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