Jump to content

Koos van de Linde

Member
  • Posts

    3
  • Joined

  • Last visited

    Never

Everything posted by Koos van de Linde

  1. Even my last suggestion doesn't work. Apparently the code of the PO is only runned after completion of the code of the procedure (a command plug in). Is there a way to force the code of the PO to run before completion of the command?
  2. I hav a vectorscript that changes several plugin objects (point objects) interactively. After changing one object, I like to see the result before changing the next one. I tried tot redraw the first PO in the following way: .... { change PO with handle h1 } ResetObject(h1); RedrawAll; .... but still the PO is not redrawn on the screen until after the whole procedure is ready. Because I have to see the result of the previous action before I can change the next PO properly, this is very unpractical. Also the following 'tricks' That I tried, dont work: .... { change PO with handle h1 } ResetObject(h1); h2:=Hduplicate(h1,0,0); DelObject(h1); RedrawAll; .... (the new copy too will initially be drawn as the unchanged original and is only redrawn after the end of the whole procedure). .... { change PO with handle h1 } ResetObject(h1); Hmove(h1,1,0); Hmove(h1,-1,0); DelObject(h1); RedrawAll; .... The only thing that probably will work, is creating a new instance of the PO and copying alle the fields of the original to the new one, in the following way: GetSymLoc(h1,x1,y1); a1:=GetSymRot(h1); h2:=CreateCustomObject(OjbName,x1,y1,a1); str1:=GetRField(h1,RecName,Field1); SetRField(h2,RecName,Field1,str1); str1:=GetRField(h1,RecName,Field2); SetRField(h2,RecName,Field2,str1); . . . str1:=GetRField(h1,RecName,FieldN); SetRField(h2,RecName,FieldN,str1); DelObject(h1); RedrawAll; but isn't there really no better and faster method?
  3. I experienced the following problem with SetPrefString, that looks like a bug: When I try to change a setting with this procedure, an arbitrary string is passed instead of the one specified in the second parameter. The value stays the same for all calls of the procedure within one run of the script but cannot be reproduced a second time. The value is apparently independant of the actual parameter value (neither its length nor its contents do influence the result), so it looks af if instead of its address some random memory address is passed by the procedure. The following code can illustrate the problem: PROCEDURE PrefStringTest; VAR frac1, dec1: LONGINT; format1: INTEGER; upi1:REAL; text1, text2, dummy1, dummy2: STRING; BEGIN { set the primary unit marks using SetUnits. It will work correctly } GetUnits(frac1,dec1,format1,upi1,dummy1,dummy2); SetUnits(frac1,dec1,format1,upi1,'MMnew',' sq MMnew'); text1:=GetPrefString(154); text2:=GetPrefString(158); AlrtDialog(concat('new unit marks (this way it works):',chr(13), ' unit=''',text1,'''',chr(13),' sq. unit=''',text2,'''')); { set the same fields with SetPrefString. It won't work. } SetPrefString(154,'MMnew2'); SetPrefString(158,' sq MMnew2'); text1:=GetPrefString(154); text2:=GetPrefString(158); AlrtDialog(concat('new unit marks (this way it doesn''t):',chr(13), ' unit=''',text1,''' (should be: ''MMnew2'')',chr(13), ' sq. unit=''',text2,''' (should be: '' sq MMnew2'')')); { reset the units for a next test } Units(4); { same problem with the text font name: it has nothing to do with the unit settings! } text1:=GetPrefString(100); AlrtDialog(concat('current text font name = ''',text1,'''')); SetPrefString(100,'Times'); text2:=GetPrefString(100); AlrtDialog(concat('new text font name = ''',text2,''' (should be: ''Times'')')); { there is no way to reset the font name correctly... } AlrtDialog('Dont forget to restore the font settings manually'); END; Run(PrefStringTest); (I tested the problem with almost all selector values given in the VS 11 appendix for string preferences, in all cases with the same result). Did anyone experience the same problem and is there a solution? Or did I something wrong? If not, is there a way to work around it? In the above example there is, but for most of the other cases (secondary units settings, units style name of both primary and secondary units) I didn't find any alternative. Thanks! Koos van de Linde
×
×
  • Create New...