Jump to content

UniGui and Javascript


dkeene

Recommended Posts

Howdy All

I seem to be working well with uniGui components and have a great deal of experience with Delphi. I am having trouble communicating between the uniForms and Javascript and am looking for documentation on the interaction between these two worlds.  For example, I correctly capture mousemove from a component and can set the X and Y values on my form with:

function mousemove(sender, x, y, eOpts)
{
   if (fmGenericTableEdit.LDesignModeNumber==0) {
      fmGenericTableEdit.LabelX.setText(fmGenericTableEdit.LDesignModeNumber);
      fmGenericTableEdit.LabelY.setText(Math.trunc(y));
   } else
   {
      fmGenericTableEdit.LabelX.setText("D"+Math.trunc(x));
      fmGenericTableEdit.LabelY.setText("D"+Math.trunc(y));
  
   }

   fmGenericTableEdit.UniConsole.setText(fmGenericTableEdit.LDesignModeNumber);
 
}

However when I try to access fmGenericTableEdit.LDesignModeNumber, (a variable to indicate a mode, for example), it is coming through as "undefined". 

Also, is there a guide to debugging the javascript code in the IDE? is that possible?

thanks!!!

doug

Link to comment
Share on other sites

Hello, thank you Hayri for your reply. 

I am trying to pass a parameter to the mousemove such that the behavior changes if the LDesignEditMode is a certain value. So far, I can't seem to find documentation on how to pass values to this function. So for example, if LDesignEditMode is equal to 0, do something, else do another thing.

Thanks

Doug

Link to comment
Share on other sites

Hello,

Sorry, but you already received a response from Farshad in the support portal:

"Those properties will not be visible to client side. Only uniGUI components will be defined. However, the defined object is the corresponding Ext JS object not a Delphi object. For example for TUniEdit we have Ext.form.Field.Text. You will be able to use object properties and method defined for Ext.form.Field.Text. Delphi side properties and methods won't be available on client side."...

Link to comment
Share on other sites

You can also create a property on the client side:

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  ...
  Self.WebForm.JSInterface.JSAssign('LDesignMode', [LDesignMode]);
end;

and in the setter method of your field:

procedure TMainForm.SetDesignMode(const Value: Boolean);
begin
  FDesignMode := Value;
  Self.WebForm.JSInterface.JSAssign('LDesignMode', [Value]);
end;

...

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...