Page 1 of 1

Function vs Indicator, is there a difference in execution

Posted: Dec 30 2015
by arjfca
Hello

I wrote some code line to erase specific text on screen

The code was written in an indicator and in a Function

When the code is executed in Indicator, all the selected text on screen is erased
When the code is executed in Function, only one Text is erased at the time. i need to click somewhere else on the screen and then reclick on the button to erase the next Text

The code is the same in the function and in the Indicator but it look a lot slower when executed in the function

Martin

Code: Select all

Var:
ValToShow (-1),
Text_ID (-1);

ValToShow = GVSetNamedInt("Filename_B",0);
Text_ID = Text_Getfirst(3);


While Text_ID <> -2 begin;
//Print ("All ID: ", Text_ID:0:0);
// Print ("Text_ID: ", Text_ID:0:0, " TEX_ID_New: ", Text_ID_New:0:0);

//Print("Border: ", text_getBorder(Text_ID), " font name: ", text_Getfontname(Text_ID), " color: ", Text_Getcolor(Text_ID):0:0);

if A_Valid_Note_Number (text_ID)then begin
Print (Text_Id:0:0);
Text_delete(Text_ID);

end;

Text_ID = Text_GetNext(Text_ID,3);

end;
Text Valid function

Code: Select all

Input:
Text_ID (NumericSimple);


A_Valid_Note_Number = False;
//Print ("Border: ", text_getBorder(Text_ID), " Font Name: ", text_Getfontname(Text_ID), " Color: ", Text_Getcolor(Text_ID):0:0);
if text_getBorder(Text_ID) = True and text_Getfontname(Text_ID) = "Verdana" and Text_Getcolor(Text_ID) = darkbrown then begin
//Print ("Valid: ", Text_ID:0:0);
A_Valid_Note_Number = True;
end;

Re: Function vs Indicator, is there a difference in executio

Posted: Jan 13 2016
by Henry MultiŠ”harts
Hello Martin,

You need to call Text_GetNext before you call Text_delete.
Please try the following code:

Code: Select all

Var:
ValToShow (-1),
Text_ID (-1), Text_ID_Next(-1);


Text_ID = Text_Getfirst(3);

While Text_ID <> -2 begin

Text_ID_Next = Text_GetNext(Text_ID, 3);

if A_Valid_Note_Number(text_ID)then begin
Print (Text_Id:0:0);
Text_delete(Text_ID);
end;

Text_ID = Text_ID_Next;

end;