1. Lawrence Anderson
  2. PowerBuilder
  3. Tuesday, 5 October 2021 19:59 PM UTC

I have a computed field on a datawindow that is set to a value of: "Description: " + trim(legal_description)

I've been requested to hide this entire field should the text overflow the allocated size, width: 2903, height 192, Autosize Height false. With Arial font sized 10, the text would be considered to have overflown when reaching 4 lines of text. Is there a way to determine this? The only solution I could think of was to check the length of the text, but the actual size is going to vary based on what the actual characters are. To specify, I'm not trying to hide text beyond a certain size, I want to show no text in circumstances where the text would overflow the specified dimensions. 

Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 5 October 2021 20:38 PM UTC
  2. PowerBuilder
  3. # 1

My example https://www.topwizprogramming.com/freecode_dwgridxp.html uses the Windows API function GetTextExtentPoint32 to determine the size of text in pixels and then uses that to implement autowidth for grid datawindows.

Open the object n_svc_dw_gridstyle and take a look at of_ResizeWidth. You could use this as an example to develop a function that would calculate the width and height of the computed field in pbunits.

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.