Jump to content

Farshad Mohajeri

Administrators
  • Posts

    12127
  • Joined

  • Last visited

  • Days Won

    811

Everything posted by Farshad Mohajeri

  1. We has Session Id which is unique: aPath + '\' + UniApplication.UniSession.SessionID + '_data1.txt';
  2. You can use this script to refresh a grid: function OnClick(sender, e) { MainForm.UniDBGrid1.store.load({params:{start:0, limit:25}}); }
  3. Why don't you call UniDBGrid.Refresh from server side?
  4. function Onmouseover(sender) { MainForm.UniLabel1.getEl().setStyle("color","#FF0000"); MainForm.UniImage1.getEl().dom.innerHTML="<img src='files/flower.jpg'/>"; }
  5. You can declare PCName in MainForm or any other Form as well, but never use a global variable. A global variable has only one instance and it is overwritten when a user assigns a new value.
  6. Is PCName a local variable in MainForm?
  7. Please give more details. How they can "see" each other's data? Where your data is stored? Which data aware components are you using? Where your data components is placed?
  8. http://forums.unigui.com/index.php?/forum/10-beta-releases/
  9. This feature is not implemented for web yet. Issue #917 Thx
  10. ServerRoot is the master root which will be used to calculate actual path of all partial roots. Consider ServerRoot is 'C:\MYAPP\' All partial paths are calculated respect to 'C:\MYAPP\' If CacheFolder is 'myfiles\' Full Cache path = 'C:\MYAPP\' + 'myfiles\' +'cache\' 'cache\' is automatically appended to user provided path: 'C:\MYAPP\myfiles\cache\' If you provide a fully qualified path for CacheFolder then ServerRoot is ignored. 'cache\' is still appended. uniGUI allows you to use complex path notations for ServerRoot such as '.\MyRoot' ,'..\MyRoot' or even '..\..\..\MyRoot' All are translated to a proper physical path name.
  11. Hello, We're in city of Ankara very far from the earthquake region. Unfortunately, it was a major earthquake with magnitude of 7.2 and casualties are expected to exceed 1000. Turkey is a country placed on major fault lines and earthquakes are common here. Sadly, weak buildings are the main cause for casualties and injuries. People seem to never learn their lesson from past earthquakes. Thanks for your posts.
  12. Are you referring to Android mobile devices?
  13. OK. It seems to be related to an issue which is already fixed. Workaround: Use all lowercase letters in Alias: Alias /web "C:/Web"
  14. You can view the generated code in browser and compare it yourself. That said, major reason for delay is Ext JS libraries which are loaded when your application is loaded for first time.
  15. Code is compiled to Win32 binary as expected and it is executed in server. Top property of pnl_header is mapped and translated to a JS property of corresponding visual object which is in browser. When you assign a new value to Top property a short JS code is generated and sent to browser which adjusts Y property of browser Panel object.
  16. Thanks for your contribution.
  17. Cristiano made me aware of this problem a while ago.I asked him to share this in forums because I think solution can be helpful for other developers too. First of all, this issue is not a bug. uniGUI objects, both visual and non-visual, are only valid when you access them inside an event generated from a web browser. Let's look at below example: Here is a simple web click event: procedure TMainForm.UniButton1Click(Sender: TObject); begin // start of safe zone where uniGUI objects can be accessed // end of safe zone where uniGUI objects can be accessed end; In below code MainForm is accessed outside of our safe zone. // TMyCallback is called asynchronously and you can't access uniGUI objects here function TMyCallback.Execute(const Arg: TJSONValue): TJSONValue; begin MainForm.QueueLogMsg(Arg.ToString); Result := TJSONTrue.Create; end; TMyCallback is called by different mechanisms which are not in sync with uniGUI. i.e. TMyCallback can be called from any thread. uniGUI objects shouldn't be accessed here. Solution: The only solution here is synchronizing TMyCallback.with uniGUI events, so uniGUI objects will be accessed from within our safe zone. I modified Main.pas and added required code to synchronize all operations. unit Main; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses, uniGUIClasses, uniGUIForm, DBXJSON, DSService, DSProxy, uniEdit, uniMemo, uniGUIBaseClasses, uniButton, DBXDataSnap, DBXCommon, DSHTTPCommon, DB, SqlExpr; type TMyCallback = class(TDBXCallback) private FCallBackResult : PString; // This pointer points to call back result FCallBackCalled : PBoolean; // Pointer to boolean which is set when callback is executed public function Execute(const Arg: TJSONValue): TJSONValue; override; end; TMainForm = class(TUniForm) UniButton1: TUniButton; UniMemo1: TUniMemo; EditMsg: TUniEdit; SQLConnection1: TSQLConnection; DSClientCallbackChannelManager1: TDSClientCallbackChannelManager; procedure UniFormCreate(Sender: TObject); procedure UniButton1Click(Sender: TObject); private FMyCallbackName: string; FCalled : Boolean; FResult : string; function WaitCallBack(TOut: Integer): Boolean; procedure InitCallBack; public procedure LogMsg(const s: string); procedure QueueLogMsg(const s: string); end; function MainForm: TMainForm; implementation {$R *.dfm} uses uniGUIVars, MainModule; function MainForm: TMainForm; begin Result := TMainForm(UniMainModule.GetFormInstance(TMainForm)); end; { TMyCallback } function TMyCallback.Execute(const Arg: TJSONValue): TJSONValue; begin FCallBackResult^:=Arg.ToString; // capture call back result here FCallBackCalled^:=True; // signal wiat loop that operation is completed Result := TJSONTrue.Create; end; procedure TMainForm.LogMsg(const s: string); begin UniMemo1.Lines.Add(DateTimeToStr(Now) + ': ' + s); end; procedure TMainForm.InitCallBack; begin FCalled:=False; // initialize variables FResult:=''; end; // Wait for call back for TOut milliseconds period function TMainForm.WaitCallBack(TOut: Integer): Boolean; begin while (not FCalled) and (TOut>0) do begin Sleep(1); Dec(TOut); end; Result:=FCalled; end; procedure TMainForm.QueueLogMsg(const s: string); begin TThread.Queue(nil, procedure begin LogMsg(s) end ); end; procedure TMainForm.UniButton1Click(Sender: TObject); var AClient: TDSAdminClient; begin // prepare call back variables InitCallBack; // make call to the server AClient := TDSAdminClient.Create(SQLConnection1.DBXConnection); try AClient.BroadcastToChannel( DSClientCallbackChannelManager1.ChannelName, TJSONString.Create(EditMsg.Text) ); finally AClient.Free; end; // Wait for response from server. Timeout is 1 second if WaitCallBack(1000) then LogMsg(FResult) // Callback method is executed. Show received message else LogMsg('Timeout'); // Callback timeout end; procedure TMainForm.UniFormCreate(Sender: TObject); var FCallBack : TMyCallback; begin // Create callback object FCallBack := TMyCallback.Create; // Assign parameters to pointers. These parameters will be assigned when callback is executed. FCallBack.FCallBackResult:=@FResult; FCallBack.FCallBackCalled:=@FCalled; FMyCallbackName := TDSTunnelSession.GenerateSessionId; DSClientCallbackChannelManager1.ManagerId := TDSTunnelSession.GenerateSessionId; DSClientCallbackChannelManager1.RegisterCallback( FMyCallbackName, FCallback ); end; initialization RegisterMainFormClass(TMainForm); end.
  18. Hello, I didn't fully understand your problem. In short, do you want to refresh Grid in Java script code?
  19. procedure TUniGUISession.SendResponse(RespStr:string; ExecCode: Boolean = True); It direcly sends a single statement to browser. It clears all pending JS codes which are already in the send queue. It is suitable for client side programming. See CleintEvents-4 demo. If ExecCode is True then code is executed, otherwise not executed. procedure TUniGUISession.AddJS(JS:string); It adds a JS statement to current code queue which is always executed.
  20. Farshad Mohajeri

    UniChart

    I think it is not possible to hide Axis. There are few properties that are published: published property SeriesList: TChartSeriesList read GetSeriesList; property Title: TUniChartTitle read GetTitle write SetTitle; property Legend: TUniChartLegend read GetLegend write SetLegend; property Align; property Anchors; end;
  21. Workaround: procedure TMainForm.UniBitBtn1Click(Sender: TObject); begin if WebMode then UniSession.AddJS('MainForm.UniDBGrid1.getView().focusEl.focus();') else UniDBGrid1.SetFocus; end; Logged #1147
×
×
  • Create New...