1. CJ Lai
  2. PowerBuilder
  3. Friday, 13 March 2020 12:43 PM UTC

Hi All

This question is somewhat related to the one I posted on 03/05/2020 titled "Muilti-line input in a datawindow (dw) object"

Thanks to Mike S's. and Michael Kramer's help, I was able to get over that hurdle.

Long story short, now I need to make that very same data input field elastic, meaning its height should adjust dynamically as user types into it. 

I have set the initial field (in free form layout) to of 76 PB units in height and retained the vertical scroll bar settings (auto and not).  I also checked the Autosize Height property of the said field.

What I found was while I am typing into the field, it does go down one line and next accordingly. HOWEVER, the field's height does Not change UNTIL the focus has switched to other fields. THAT will not fly with the users...

Is there a way, or, how, to make that 'autosize height' work in real time?

 

Also, since there is an OK button right below that field, in what object.event should I put script so that the button would move down to maintain the same distance to the data field as the field expends?

 

Thank you!

CJ

 

Accepted Answer
Michael Kramer Accepted Answer Pending Moderation
  1. Friday, 13 March 2020 13:24 PM UTC
  2. PowerBuilder
  3. # Permalink

I'm half laughing, half crying. Such a nice solution and now it doesn't fly!

Anyways, resize edit field while user types requires some what elaborate coding because you need DataWindow to redraw whilst edit in progress. Only way I know within EditChanged to do:

  1. Record position of cursor within the text.
  2. AcceptText() - which forces the full validation process
  3. Via ItemChanged ensure cursor remains in current item
  4. Reposition cursor at same position as when EditChanged started.

I expect AcceptText will kick off so much activity that steps (2) - (4) need to be wrapped in separate function/event which is posted from EditChanged.

As you can see from my own Q&A on temp compiler files I'm quite busy today solving my own issues so I hope you can make progress without further assistance from me.

Godspeed, /Michael

Comment
  1. CJ Lai
  2. Friday, 13 March 2020 14:58 PM UTC
Thanks, Michael



I am able to make that edit field expend in real time by putting Accepttext() in the EditChanged event. I, however, can not figure out how to calculate and capture the 'after' edit field's height. It stays at the painter value throughout the execution of my code.



Any insight?



Thanks!
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 13 March 2020 15:37 PM UTC
  2. PowerBuilder
  3. # 1

Hi CJ;

   FWIW: The AutoSize column & band feature was designed only for read only "report" style DWO's and not input.

  IMHO:  Just stick to fixed sized DWO's & columns and just enable the vertical scrollbar. Then if you wish, have a "preview" DWO that uses a ShareData () to show the user how the whole DW Column will look like as yo type into the fixed DWO column.

Food for thought.

Regards ... Chris

Comment
  1. CJ Lai
  2. Friday, 13 March 2020 15:57 PM UTC
Thank you, Chris, for your comment.

I am able to get that real-time autosize to work although that feature is not intended for such use.

For my paycheck, and it can never be big enough, I have to carry out user's requirement.



All I have to do next is to figure out how to calculate and capture the expended edit field's X/Y/Height/Width.
  1. Helpful
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.