-
Posts
356 -
Joined
-
Last visited
-
Days Won
18
Content Type
Profiles
Forums
Events
Posts posted by Oliver Morsch
-
-
//Clientside THIS IS NOT HOW TO DO IT !!!
Apanel.ClientEvents.ExtEvents.Add('function onAfterrender(sender) { document.getElementById(sender.body.id).className += " hoverpanel"; }');
Try this:
Apanel.ClientEvents.ExtEvents.Add('onAfterrender=function onAfterrender(sender) { ...
-
it is only a monitor.
Then I would use long polling to refresh "the monitor".
-
Do I understand right: You want to "push" changes from the server to the client (without that the client has sent a request to get this)?
In UniGui/Web you can only answer to a request from the client!
You can use an UniTimer, use websockets (HTML5) or use "Long Polling" (see here)
-
// UniForm1.script:
function setMaskeventClosewindow(target) {
var elements = document.body.getElementsByTagName('div');
for (var i = 0; i < elements.length; i++) {
if (elements[i].className.indexOf('mask') != -1) {
elements[i].onclick = function() {target.close();};
}
}
}
// UniForm1.onShow:
procedure TuniForm1.UniFormShow(Sender: TObject);
begin
UniSession.AddJS('setMaskeventClosewindow(' + self.WebForm.ExtWindow.JSName + ');');
end;
// call in MainForm:
UniForm1.ShowModal;
-
MessageDlg, ShowModal, ShowMessage don't "stop" the code execution in UniGui/WebMode, so you do:
(1) You start a Modal Dialog and
(2) give a (the initial !) result back.
(3) After you click on OK/Cancel/Yes/No/...
(4) the anonymous procedure (callback procedure) is called
=> (2) is before (3) and (4) so it can't contain the future result !!!
-
Only inserts rows on a table
Do you use
(1) a database component such as TTable and use Table.append/insert
OR
(2) send SQL statements to the database server (insert into table ....)
2nd should be better for your purpose.
And how is the RAM usage on the server: How much it increases by a new user session and over time?
-
(1) Use show instead of showmodal
OR
(2) After showmodal you must use javascript and search a div element with class "x-mask" and add an onclick event there which closes the form.
-
If anyone has more ideas, please let me know.
Instead of using a (global) function "choose_city(): integer" which returns an integer, I would use a (global) procedure "choose_city(DoAfterChooseCity: TDoAfterChooseCityProc)" which gets an anonymous procedure that contains the code to do after the city was choosen. And then call:
choose_city(procedure(CityCode: Integer) begin //do this after the user has choosen a city... end);
- 1
-
sender.addCls(...);
And I tried to use "sender.body.className" without success, so that I had to do this: "document.getElementById(sender.body.id).className"...
thx
-
Simple version:
-> in "TUniPanel / ClientEvents / ExtEvents -> OnAfterrender":
function OnAfterrender(sender) { document.getElementById(sender.body.id).className += " hoverpanel"; }
-> in "UniServerModule / CustomCSS":
.hoverpanel:hover { background-color: #0077FF; }
- 2
-
I asume that you create the reports for the customer. I'm still looking for a way the
user can create is own reports (like FastReport Designer) and store them in a
database or as a file from within uniGui
I think you are looking for this:
http://mobile.stimulsoft.com/Designer.aspx?reportname=SimpleList
A alternative is that we created a Windwos .exe file containing the designer
which the user has to start on his computer, design the report and storie
it in the database.
In reportmanager there is also an exe for creating reports standalone. But I think it is not usable by end users.
-
For FastReport the users wait for years for some handy and accurate integrated PDF exporting
I use reportmanger (open source, http://reportman.sourceforge.net/ ). This comes with an additional console app to create PDF's. This I start using createProcess() in UniGui-App and give it the needed parameters. It's very very fast.
-
Long time ago, but here is a sample.
-
-
Hi!
I have developped a message server, so you can send "push" messages at any time from the server to the web client (using long polling). You can also send messages from a client to another client (with message server in the middle).
The message server is a standalone app. You must run MsgSrv.exe and MsgCli.Exe (second is a uniGui project).
I was using Delphi XE3 (with generics, class vars, ...), so i have included the .exe, because the message server does not compile in old delphi versions.
For details see the commented screenshot.
Regards
Oliver
- 8
-
This is very interesting. Please describe in detail or to share an example.
I have to do and test a view things. After that I will share it.
- 2
-
Solved! I had not to change the UniGui response header. I had to change the XMLHttpRequest header (no custom headers) and the message server response header (add " Access-Control-Allow-Origin: * " there).
Now I have "long polling" and so I can send "push messages" from UniGui server to all UniGui clients (browsers) and more.
-
Hi!
Is it possibble to add something to the http header (response)?
I have an own standalone "message server" on another port and use XMLHttpRequest (in clientside javascript) to get/post messages.
In IE10 it works properly. But in Chrome it returns with status 0 and I think this is because XSS security. So I want to try the "Content-Security-Policy" header.
Regards
Oliver
-
Send the value of the javascript variable to the server using ajaxRequest(...)
-
Use either TField.OnGetText() or a calculated field to change the text before displaying.
-
hi,
How do I get the Client pc MAC address?
see here:
-
Use "self.Components..." or just "Components..." instead of "UniFrame3.Components...".
And never use a global var, because each user/session would use the same var. If needed use fields / properties.
-
How to add a picture upload function?
You can buy a file manager (file browser and uploader) on http://www.tinymce.com/index.php (but i think it needs PHP on server) or you can make your custom file browser (with UniGui):
http://www.tinymce.com/wiki.php/Configuration3x:file_browser_callback
http://www.tinymce.com/wiki.php/TinyMCE3x:How-to_implement_a_custom_file_browser
There you can upload (TUniFileUpload) and/or browse your files to/on the server.
I have added this to my script/init for including TinyMCE (adds a button to file/image dialog for calling my file browser):
<script type="text/javascript"> function myCustomFileBrowser(field_name, url, type, win) { //z-Order of tinyMCE popup dialog must be less than uniGui modal dialog: document.getElementById('mceModalBlocker').style.zIndex = 7001; document.getElementById('mceModalBlocker').previousSibling.style.zIndex = 7002; //"save" fieldname for later update: TinyMceFileSrcFld = win.document.forms[0].elements[field_name]; //Start my UniGui FileBrowser: ajaxRequest(MainForm.form, 'FileBrowser', [ 'URL=' + url, 'Typ=' + type ]); } ... tinyMCE.init({ ... file_browser_callback : "myCustomFileBrowser", ... }); </script>
on MainForm i have this (on AjaxRequest start file browser form):
procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TStrings); begin if EventName = 'FileBrowser' then begin frmFileBrowser.URL := Params.Values['URL']; frmFileBrowser.Typ := Params.Values['Typ']; frmFileBrowser.ShowModal; end; end;
on closing the file browser form i do this:
procedure TfrmFileBrowser.UniFormClose(Sender: TObject; var Action: TCloseAction); begin if ModalResult = mrOK then begin UniSession.AddJS('TinyMceFileSrcFld.value = ' + QuotedStr(FileURL) + ';'); end; end;
In the future i plan to use Data URI scheme to include the image in the HTML itself.
-
You can use "ajaxRequest(...)" in the javascript function "function Onmousemove(sender, x, y){...}" to send the values as parameter to the server and handle it there in delphi (see forum).
But: The event Onmousemove you should handle in javascript, because there would be very much messages send to the server.
Mouseover or hover over panel - change color or effect
in General
Posted
This works for me (you must give the component a unique name):