delphi - PosEx not works in Design-Time Package -


i have created design-time package delphi7 ide. want component on form offer me menu items in context menu during design-time. when debug package, can see code gets executed, when comes line using built-in function posex, behaviour confuses me. in debugger, can see text search in contains part search for, function returns 0 anyway! and, if execute directly (instead of debugging ide using in project) works fine.

this code:

function removeleftoverplaceholders( var pio_stemplate: string); var nstartpos: integer; const jpcg_foreach_start = '{%foreach '; begin   nstartpos := 0;    repeat     nstartpos := posex( jpcg_foreach_start, pio_stemplate, nstartpos ); // <-- nstartpos 0 !     if nstartpos > 0 begin       ...     end;   until nstartpos = 0; end; 

is possible string types changed during execution in ide? (any ansistring-unicode problem?)

edit: i'm using gexperts , delphispeedup

stupid... answer stands right in code... nstartpos initialized 0, whichs leads failing posex. strange worked when executing code out of design pack...


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -