[futurebasic] Re: [FB] Munger experts. Help.

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 1999 : Group Archive : Group : All Groups

From: Jay Reeve <jktr@...>
Date: Mon, 20 Sep 99 23:40:26 -0500
>Problem restated:
>It works perfectly as long as the find$ and replace$ are equal in length.
>However, when the length find$ and replace$ are unequal the last 
>characters of
>the text handle are altered by a length = to the difference between the find$
>and replace$ times the number of changes made.

The problem you're having is because the length word of your ZTXT handle 
has not been reset. As I explained to tedd last month, FN MUNGER will 
adjust the handle size, but a ZTXT handle is a purely FB structure, about 
which FN MUNGER knows nothing. Therefore, you have to adjust the length 
word yourself. This should work if you do it just before reinserting the 
handle into a field (providing, of course, that there is no style data 
following the text):

& [txtH&], size-2

Using FN MUNGER on a ZTXT handle can be dangerous because of the 
possibility of getting style info following the text when you least 
expect it. Some may disagree, but I think you're usually better off 
operating directly on a field's text handle, then recalculating the field 

  textH& = teHndl&..teTextH&                     'get text handle
  FN Mung&(tgt$,repl$,textH&,start&,mungMode)    'use MUNGER
  CALL TECALTEXT(teHndl&)                        'recalculate field info
  CALL INVALRECT(#[teHndl&]+_teViewRect)         'force redraw

 =J= a  y