Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 31 JUL 2003 11:05:40AM John Bouley wrote:

I have a text box that contains verbage that will wrap. Unfortunately, the text does not save where it actually wrapped. Therefore, when I am trying to use OIPI to print the text it does not wrap in the same place.

This is sort of like WYSINWYG (What you see is Not what you get).

Idealy, it would be nice to be able to identify where the text wrapped on the control and save that info with the text.

Any ideas?

Thanks,

John


At 31 JUL 2003 03:18PM John Bouley wrote:

Never mind, I found a way around the issue that will work.


At 31 JUL 2003 03:58PM Oystein Reigem wrote:

John,

Never mind, I found a way around the issue that will work.

Just as I was about to make you a reply.

Anyway… I don't know of an easy way to find the break points. With Utility "TEXTRECT" you can find out how wide and tall a certain text in a certain font becomes when displayed within a certain width. A very crude method to find the points where the text breaks could be to do loop n=1, 2, 3, etc, with Utility "TEXTRECT" on the first n characters of the text. When the height you get back from Utility increases from one character to the next there is a break point.

So actually it isn't so difficult but it's not very elegant.

(For more details do a search on Utility and TEXTRECT and Bakke.)

You can find the same functionality as Utility "TEXTRECT" in OIPI's Get_Printer/Set_Printer "CALCTEXT". So you can do the same calculations in OIPI if that suits you better.

- Oystein -


At 01 AUG 2003 09:03AM John Bouley wrote:

Thanks for the reply!

I just figured that it wasn't as important as I initialy thought to determine where the text wraps. The client will have to test the final output and if they are unhappy then they can always go back in and press the enter key where they want a new line.

Your solution does sound interesting though!

Thanks,

John Bouley


At 01 AUG 2003 10:32AM Richard Hunt wrote:

John,

If you really want to know where the text actually wraps, ya might want this code. "LINE" is the line you want the info on. "START_POS" is the character position of the text that the line starts on. Remember these are zero-based indexes.

DECLARE FUNCTION SENDMESSAGE

EM_LINEINDEX=187

EM_LINELENGTH=193

HANDLE=GET_PROPERTY(CTRLENTID,'HANDLE')

LINE=2 - 1

START_POS=SENDMESSAGE(HANDLE,EM_LINEINDEX,LINE,0)

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/editcontrols/abouteditcontrols.asp

Look for EM_LINEINDEX.

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/c25d1ad4c5b803f085256d740052eaef.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1