TTMSFNCMemo exception.

Hi',

I'm triying to add sources to a TTMSFNCMemo on the OnShow Event, but I get the following exception.

Uncaught SyntaxError: "undefined" is not valid JSON
at JSON.parse ()
at Object.ParseJSONValue (WEBLib.JSON.pas:595:15)
at Object.ParseJSON (WEBLib.TMSFNCUtils.pas:3016:24)
at Object.GetPosition (WEBLib.TMSFNCMemo.pas:3057:20)
at Object.SetActiveSource (WEBLib.TMSFNCMemo.pas:3577:33)
at Object.Create$1 (WEBLib.TMSFNCMemo.pas:5396:10)
at c.$create (rtl.js:332:1)
at Object.Add (classes.pas:5108:21)
at Object.Add$1 (WEBLib.TMSFNCMemo.pas:5479:41)
at Object.AddSource (WEBLib.TMSFNCMemo.pas:5510:13)

sample code:
procedure TForm1.WebFormShow(Sender: TObject);
var
MemoSource : TTMSFNCMemoSource;
begin
MemoSource := BasicMemo.Sources.AddSource('texto 0',mlPascal,'source 0');
end;

Any hint,

Thanks in advance,

Omar Zelaya

Hi,

Sorry for the delayed response. You need to add the code to the 'OnInitialized' event of the TTMSFNCMemo. In the 'OnShow' the memo has not been yet initialized.

Hi, i'm having a issue adding sources at code, with have the following test, the memo never shows the test0 text. Any hints?

Thanks in advance,

Omar Zelaya

procedure test;
procedure CreaTabs;
var
Tab : TTMSFNCTabSetTab;
begin
for i := 0 to WebMemo1.Sources.Count - 1 do
begin
Tab := TMSFNCTabSet1.Tabs.Add;
Tab.Text := WebMemo1.Sources[i].Name;
if WebMemo1.Sources[i].Name <> '' then
Tab.Visible := true
else Tab.Visible := false;
Tab.CloseButton := false;
end;
end;

begin
MemoSource := WebMemo1.Sources.AddSource('test0',mlPascal,'test0');
MemoSource := WebMemo1.Sources.AddSource('test1',mlPascal,'test1');
MemoSource := WebMemo1.Sources.AddSource('test2',mlPascal,'test2');
MemoSource := WebMemo1.Sources.AddSource('test3',mlPascal,'test3');
CreaTabs;
end;
procedure TfrmEditor.TMSFNCTabSet1ChangeTab(Sender: TObject; APreviousTabIndex,
ACurrentTabIndex: Integer);
begin
WebMemo1.ActiveSource := ACurrentTabIndex;
end;
Captura desde 2024-02-09 19-52-24
Captura desde 2024-02-09 19-53-05
Captura desde 2024-02-09 19-53-29
Captura desde 2024-02-09 19-53-51

Hi,

We have fixed this issue, this will be included in the next update of the TMS FNC UI Pack.

You'll need to call 'test' from the OnCreate of the form and it should work then.

Hi,

I have updated to latest version and I'm still having the same issue loading the sources on the OnInitialized event. If I call "test" from the OnCreate event I get a Exception in file WEBLib.TMSFNCUtils,js at line 1243 at Object.GetPosition from WEBLib.TMSFNCMemo.js:2705 at Object.SetActiveSource.....

Any hints?

Thanks in advance,

Omar Zelaya