On Mon, 22 Dec 2003 22:06:01 +1300, Rudy Seoa wrote:
>> Declaration for a function that takes an int by value and returns its
>> square might look like this.
>> function sqaure (x :int):int;
>> begin
>> foo := x * x;
>> end; //return statement is assignment into function name.
>
> Pascal's integer type is 'integer' not 'int'.
>
> This will work:
> function square (x :integer):integer;
> begin
> square := x * x;
> end;
>
>> however in the script examples the functions are of this form...
>>
>> function sqaure (x :int):int;
>> begin
>> result := x * x;
>> end; //return statement is assignment into result.
>> //result is not declared anywhere, seems to be a typeless global?!
>
> This should work as well, if you correct the integer declarations.
>
> The scripting is standard Object Pascal so any Delphi programming
> resource should help you, and there's a bunch of example scripts in the
> Dialog homepage's Wiki.
>
> Dialog looks promising, but it's still very beta'ish (I could make it
> crash with a AV in the initial configuration wizard)
Hey tyvm!
Sorry bout the int declarations, I was in C++ Mode.
I like to think I am familiar with CBuilder so the VCL types in Dialog are
all familiar.
The first form (which sits more comfortably with me, the second suggests a
loosely typed global called result - which is an odd thing to have in a
strictly typed langauge) will not work in Dialog.
specific example:
FUNCTION GetClipboardData(var memo:TMemo):boolean; //Copy Clipboard data
var b:boolean; //redundant ?
begin // return true if data copied.
memo.Clear();
memo.PasteFromClipboard();
GetClipboardData := b; //memo.Lines.Count > 0; //this is line 87
end;
Failed when compiling
[Error] (87:26): open round ('(')expected
When I saw that I worried that the lvalue in the return statement may not
accept an expression on the lhs, which is why I declared a local variable
first.
again with out local boolean variable
FUNCTION GetClipboardData(var memo:TMemo):boolean; //Copy Clipboard data
begin // return true if data copied.
memo.Clear();
memo.PasteFromClipboard();
GetClipboardData := memo.Lines.Count > 0; //this is line 87
end;
Failed when compiling
[Error] (87:26): open round ('(')expected
finally ...
FUNCTION GetClipboardData(var memo:TMemo):boolean; //Copy Clipboard data
begin // return true if data copied.
memo.Clear();
memo.PasteFromClipboard();
result := memo.Lines.Count > 0;
end;
Compiles ok.
So I am going to stick with the result syntax.
Ive spent some time at WIKI and run some event scripts (ur right, a little
buggy, well perhaps not buggy so much as 'interesting'

) and I am
bastardizing Alains script which iterates over a group.
Trouble with his example is he has output to a form, set options via ini
file and with an option form confirm and some code for restoring the views.
I can live without all that and its a powerful complication around the
iterator.
ty again
Warwick