How to get result from TExtFunction?

15 views
Skip to first unread message

Brainenjii

unread,
Jun 30, 2010, 8:51:23 AM6/30/10
to ExtPascal
Hi all.
How can I get a string value from field of ExtData.TExtDataRecord? For
example, I use TExtGridGridPanel with TExtGridRowSelectionModel. So,
when I want to get selected row I do:

Var
aStringList: TStringList;
aRecord: TExtDataRecord;
Begin
aRecord := TExtDataRecord(TExtGridRowSelectionModel(CurrentThread.
MyForm.MyGrid.SelModel).GetSelected);
ExtMessageBox.Alert('header',
aRecord.JSString(aRecord.Get('dataindex')));
aStringList := TStringList.Create;
aStringList.Add(aRecord.JSString(aRecord.Get('dataindex')));
aStringList.SaveToFile('/path/to/file.txt');
aStringList.Free;
End;

And browser show me correct value. But file.txt has only string like
'$7DE7'. Where is the problem?

Thanks!

Wanderlan

unread,
Jun 30, 2010, 9:35:16 AM6/30/10
to ExtPascal
Using Ajax only! By example:

with TExtButton.AddTo(Items) do begin
Text := 'A button';
Handler := Ajax(GetDataIndex, ['DataIndex',
aRecord.Get('dataindex')]);
end;

aRecord.Get is evaluated by browser and returned thru Ajax to Server.

-Wanderlan-

Brainenjii

unread,
Jul 1, 2010, 1:23:00 AM7/1/10
to ExtPascal
Hi Wanderlan,

Yes, I use this method usually but I can use in Ajax only published
methods. And only TAppThread can have this kind of methods. Or I'm
wrong in it?

Thanks!

Brainenjii

unread,
Jul 1, 2010, 4:29:54 AM7/1/10
to ExtPascal
Got it! If I use {$M+} switch for declare classes like TExtWindow Then
I can use "Published" section for methods! And use Ajax with
procedures in one unit! Superb! It need to change ExtPascal Toolkit
for generate forms units with {$M+} by default, I think.

Thanks

Wanderlan

unread,
Jul 1, 2010, 8:53:28 AM7/1/10
to ExtPascal
NO. See ExtPascalSamples.dpr, other classes can have published methods
called by Ajax.

-Wanderlan-
Reply all
Reply to author
Forward
0 new messages