ExtPascal.pas begin end section - TExtUtilTextMetrics.Create('body')

95 views
Skip to first unread message

Григорий Поверенный

unread,
Jul 30, 2013, 2:30:17 AM7/30/13
to extp...@googlegroups.com
In the file ExtPascal.pas 

Has section 

begin

  ExtUtilTextMetrics := TExtUtilTextMetrics.Create('body');
  ExtUtilTextMetrics.FJSName := 'TextMetrics';

end.

debug goto 

procedure TExtObject.CreateVar(JS : string); begin
  CreateJSName;

at the CreateJSName - use - TExtThread(CurrentWebSession).GetSequence

CurrentWebSession is nil  ....


How to pach this error....

A comment this  
 //ExtUtilTextMetrics := TExtUtilTextMetrics.Create('body');
 //ExtUtilTextMetrics.FJSName := 'TextMetrics';

In browser I found error - 

Object function constructor() { return this.constructor.apply(this, arguments) || null; } has no method 'createInstance'


Григорий Поверенный

unread,
Aug 1, 2013, 8:20:56 AM8/1/13
to extp...@googlegroups.com
I change in ExtPascal.pas 

Ext.util.TextMetrics.CreateInstance("body") 

on 

Ext.util.TextMetrics("body")

and all work.

Still do not understand why all ExtUtilTextMetrics as a global variable.

Marcos Douglas

unread,
Aug 1, 2013, 8:42:16 AM8/1/13
to extp...@googlegroups.com
On Thu, Aug 1, 2013 at 9:20 AM, Григорий Поверенный <grig...@gmail.com> wrote:
>
> I change in ExtPascal.pas
>
> Ext.util.TextMetrics.CreateInstance("body")
>
> on
>
> Ext.util.TextMetrics("body")
>
> and all work.

Maybe you should create a patch file.

>
> Still do not understand why all ExtUtilTextMetrics as a global variable.
>

I do not know too.

Marcos Douglas

Григорий Поверенный

unread,
Aug 1, 2013, 8:53:02 AM8/1/13
to extp...@googlegroups.com
Index: ExtPascal.pas
===================================================================
--- ExtPascal.pas (revision 819)
+++ ExtPascal.pas (working copy)
@@ -44,7 +44,7 @@
 
 // Enabling WebServer directive ExtPascal can be used within an embedded Indy based WebServer
 {$IFNDEF SERVICE}
-{.$DEFINE WebServer}
+{$DEFINE WebServer}
 {$ENDIF}
 
 // Uses ext-all-debug.js, format all JS/CSS source code to facilitate debugging on browser and locates line error if using Firefox on AJAX responses
@@ -54,7 +54,7 @@
 {.$DEFINE CacheFly}
 
 // Uses DebugExtJS to load ext-all-debug.js library instead ext-all.js to debugging purposes
-{.$DEFINE DebugExtJS}
+{$DEFINE DebugExtJS}
 
 interface
 
@@ -242,6 +242,8 @@
   TMixed = TExtObjectList;
 //DOM-IGNORE-END*)
 
+  procedure InitTextMetrix;
+
 const
   DeclareJS    = '/*var*/ '; // Declare JS objects as global
   CommandDelim = #3;         // Internal JS command delimiter
@@ -785,7 +787,7 @@
       (IfThen(CustomJS = '', '', CustomJS + ^M^J) +
       'Ext.onReady(function(){' +
       'Ext.get("loading").remove();' +
-      'Ext.BLANK_IMAGE_URL="' + ExtPath + '/resources/images/default/s.gif";TextMetrics=Ext.util.TextMetrics.createInstance("body");'+
+      'Ext.BLANK_IMAGE_URL="' + ExtPath + '/resources/images/default/s.gif";TextMetrics=Ext.util.TextMetrics("body");'+
       'function AjaxError(m){Ext.Msg.show({title:"Ajax Error",multiline:true,msg:m,icon:Ext.Msg.ERROR,buttons:Ext.Msg.OK});};' +
       {$IFDEF DEBUGJS}
       'function AjaxSource(t,l,s){var w=new Ext.Window({title:"Ajax error: "+t+", Line: "+' + IfThen(Browser=brFirefox, '(l-%%)', '"Use Firefox to debug"') +
@@ -930,7 +932,10 @@
 
 // Set an unique <link TExtObject.JSName, JSName> using <link TExtThread.GetSequence, GetSequence>
 procedure TExtObject.CreateJSName; begin
-  FJSName := 'O' + IdentDelim + TExtThread(CurrentWebSession).GetSequence + IdentDelim;
+  if CurrentWebSession = nil then
+    FJSName := 'O' + IdentDelim + '0' + IdentDelim
+  else
+    FJSName := 'O' + IdentDelim + TExtThread(CurrentWebSession).GetSequence + IdentDelim;
 end;
 
 {
@@ -1906,7 +1911,12 @@
   Result := TExtObject(TExtThread(CurrentWebSession).GarbageFind(CurrentWebSession.Query[ParamName]));
 end;
 
+procedure InitTextMetrix;
 begin
   ExtUtilTextMetrics := TExtUtilTextMetrics.Create('body');
   ExtUtilTextMetrics.FJSName := 'TextMetrics';
+end;
+
+begin
+
 end.

Григорий Поверенный

unread,
Aug 1, 2013, 8:59:54 AM8/1/13
to extp...@googlegroups.com
This is generate file from ext-4.2.1.883 modify

Litl tested:-)

Ext.pas
Reply all
Reply to author
Forward
0 new messages