[Migrated content. Thread originally posted on 28 June 2005]
Does anyone know of a helpful ratio to use to vary the vertical size of a multiline entry field according to the number of lines to be allowed?Page 1 / 1
[Migrated content. Thread originally posted on 28 June 2005]
Does anyone know of a helpful ratio to use to vary the vertical size of a multiline entry field according to the number of lines to be allowed?Do you want to dynamically size an entry-field based on how many lines need to be edited?
A multiline entry-field which is set to display a certain number of lines will scroll vertically depending on the text that is enterred and also the MAX-TEXT value of the field.
If the value of the field can be up to 1000 characters in size and your entry-field is only 2 lines high, then it displays a 'window' on the portion of the 1000 characters that you are currently editing.
At least, that's what it does in the character-based version. Are you using the GUI version?
[Migrated content. Thread originally posted on 28 June 2005]
Does anyone know of a helpful ratio to use to vary the vertical size of a multiline entry field according to the number of lines to be allowed?[Migrated content. Thread originally posted on 28 June 2005]
Does anyone know of a helpful ratio to use to vary the vertical size of a multiline entry field according to the number of lines to be allowed?[Migrated content. Thread originally posted on 28 June 2005]
Does anyone know of a helpful ratio to use to vary the vertical size of a multiline entry field according to the number of lines to be allowed?It's not exactly precise for proportional fonts where alot of upper-case characters are used, but that should be rare.
If this doesn't work out then perhaps you could create a common routine where you pass in:
- window handle
- font handle(if you can inquire entry-field for font handle then no need to pass, I can't remember)
- entry-field handle
- data item size(use Format 8 of the SET verb to get the data item size dynamically)
Then, as Rob recommended, use W$TEXTSIZE passing window handle and font handle to get font width in window cell units.
Next, calculate the entry-field lines:
entry-field lines = data item size / (entry-field size(in cell units) / TEXTSIZE-BASE-X)
Next, modify the entry-field handle with the entry-field lines.
[Migrated content. Thread originally posted on 28 June 2005]
Does anyone know of a helpful ratio to use to vary the vertical size of a multiline entry field according to the number of lines to be allowed?I knocked up the attached test program which seems to do the trick in a character-based environment. Sorry, I haven't got time to try it in GUI at the moment, but the theory should still work.
It's a bit 'clunky', but basically it works like this:
1) Display the ENTRY-FIELD containing the data you want to display, with an initial number of LINES. (NOTE: You must specify the NO-AUTOSEL style)
2) Modify the CURSOR setting of the field to be equal to your MAX-TEXT setting
3) ACCEPT the field BEFORE TIME ZERO to make the runtime position the cursor at the end of your data
4) INQUIRE on the field to get the value of the CURSOR-ROW setting.
5) MODIFY the field's LINES setting to be the same as the CURSOR-ROW
Let me know if this works for you.
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.