WPCubed Product Support

Change procedure from WPTools3 to WPTools5

Hi

I have this code (WPTools 3) and I'm trying to change for the version 5.
Can somebody help me?

Thanks.

procedure TAtualFolderForm.MoveObjTo(obj: TWPObject; relx, rely: Integer);
var
  P: PTTextObj;
begin
  P := WPRichText1.Memo.FirstObj;
  while p<>nil do begin
    if p^.obj = obj then break;
    p := p^.next;
  end;
  if P<>nil then begin
    WPRichText1.TextObjects.ConvertType(P,wpotPar);
    P^.relx := relx;
    P^.rely := rely;
    WPRichText1.Memo.Repaint;
  end;
end;
#1 ♥ 0
10.8k Views 2 users read 1 min
support
// locate a certain TWPObject     WPRichText1.TextObjects.Selected := Obj;     // and move it (using the reference TWPTextObj)     with WPRichText1.TextObjects.SelectedObj do     begin        PositionMode := wpotPar;        RelX := relX;        RelY := relY;     end;

alternatively you can also the list ObjList[0..ObjCount-1]:

for i:=0 to WPRichText1.TextObjects.ObjCount-1 do
       if WPRichText1.TextObjects.ObjList[i].ObjRef=anObj then
       begin
        WPRichText1.TextObjects.ObjList[i].PositionMode := wpotPar;
        WPRichText1.TextObjects.ObjList[i].RelX := 5000;
        WPRichText1.TextObjects.ObjList[i].RelY := 5000;
       end;

Please note that the list is built up by using the function ObjCount. So it is save to use it with a (pascal) "for" loop, but better avoid a while loop. In C++ you must save ObjCount to a variable first.

Regards,

Julian

#2 ♥ 0
This category is archived. No new posts are possible.