• 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. Format text output on the DBox

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 143
  • Views 3121
  • 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

Format text output on the DBox

Martinsh
Martinsh over 1 year ago

I'd like to create a format text output on a DBox created by hiDisplayUserDBox() function. The skill code is as following.  What I want is "Word1" and "LongWord1", "Word2" and "LongWord2", "Word3“ and "LongWord3" are aligned virtically. But they don't. Why? And how to make that?

line1 = lsprintf("%-20s %-20s %-20s\n" "Word1" "Word2" "Word3")
line2 = lsprintf("%-20s %-20s %-20s\n" "LongWord1" "LongWord2" "LongWord3")
outMessage = strcat(line1 line2)
hiDisplayUserDBox(
?name 'dBox
?dboxBanner "Format output test"
?dboxText outMessage
?dialogType hicQuestionDialog
?buttons '(Cancel)
)

Thanks!

Martin

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 1 year ago

    Martin,

    This is because the font used has a variable width, so alignment is rather difficult just by padding with spaces.

    You could add some simple HTML tags around the message:

    outMessage = strcat("<pre>" line1 line2 "</pre>")

    Which would give you:

    (note that the <pre> tag has caused it to use a monospaced font).

    Regards,

    Andrew

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

    Andrew,

    It works well. Thanks!

    Martin

    • 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