I'm using the following Code to loop over all objects and delete some images:
param:=TObject.Create;
FWPRichText.Memo.RTFData.LoopAllObj(param, DeleteImage);
In 5.09 it worked fine but in 5.18.1 it does not get into the DeleteImage-Callback-Procedure.
Am I doing anything wrong?
#1
♥ 0
🔗
6.2k Views
2 users
read 2 min
This is how LoopAllObj is defined:
I checked the code - it should work alright. Do you use the global or the object callback method?
Julian
#2
♥ 0
🔗
Hi!
I have declared the callback-function in the same class where I'm using the LoopAllObj-function:
procedure TWordHelp.DeleteImage(RTFData: TWPRTFDataCollection;RTFDataBlock: TWPRTFDataBlock;par: TParagraph;obj: TWPTextObj;param: TObject);
#3
♥ 0
🔗
I tested it again. In this context I'm using a TWPCustomRichText that I create like this:
FWPRichText:=TWPCustomRichText.CreateDynamic;
I set a breakpoint in LoopAllObj at this point:
CallBack(Self, Block, par, obj, Param);
If I step into this function it takes me to
procedure AddWPObject(
RTFData: TWPRTFDataCollection;
RTFDataBlock: TWPRTFDataBlock;
par: TParagraph;
obj: TWPTextObj;
param: TObject);
in the unit WPRTEDefs.
When I use the same code on my form where I have a visible TWPRichText it works fine and I get into my DeleteImage-Callback.
What am I doing wrong?
#4
♥ 0
🔗
Hi,
It is possibkle that the data does not contain any objects. Please add a FWPRichText.SaveToFile to make sure the text is complete.
Maybe also call the LoopAllObj function with the last optional parameter set to nil - to make sure the compiler did not add nonsense here.
Julian
#5
♥ 0
🔗
Thank you for your tips. I tried them out but it did not help.
I think the objects should be there because the LoopAllObj-function reaches the call of the callback-function but then it jumps into the wrong callback-function.
#6
♥ 0
🔗
You can loop the objects in your own code - using par.ObjectRefs[i] that is pretty easy.
Julian
#7
♥ 0
🔗
This category is archived. No new posts are possible.