artem_niko Posted November 30, 2022 Share Posted November 30, 2022 Good afternoon! Is there (is it possible) for a UniFrame to have an analog of the OnMouseMove or OnClick property? I need to execute some code while the mouse cursor is within the entire UniFrame. An important point: it does not matter which component the mouse is specifically located on or activated (UniEdit or UniPanel, etc.). Exactly, as long as it is within the UniFrame. Link to comment Share on other sites More sharing options...
Sherzod Posted November 30, 2022 Share Posted November 30, 2022 19 minutes ago, artem_niko said: OnMouseMove But what kind of code do you want to execute, client side or server side? Because let's say the mousemove event will be called many times... Link to comment Share on other sites More sharing options...
artem_niko Posted November 30, 2022 Author Share Posted November 30, 2022 6 minutes ago, Sherzod said: But what kind of code do you want to execute, client side or server side? Because let's say the mousemove event will be called many times... What kind of code? Well, passing a pair of variables from UniFrame to MainForm. There will be no SQL queries or database accesses at this point. Link to comment Share on other sites More sharing options...
Sherzod Posted November 30, 2022 Share Posted November 30, 2022 Maybe will use a mouseover event? Link to comment Share on other sites More sharing options...
artem_niko Posted November 30, 2022 Author Share Posted November 30, 2022 Just now, Sherzod said: Maybe will use a mouseover event? Well, if using this event will be better and will give the desired result, then you can use it Link to comment Share on other sites More sharing options...
Sherzod Posted November 30, 2022 Share Posted November 30, 2022 https://www.w3schools.com/jsref/event_onmouseover.asp https://www.w3schools.com/jsref/event_onmousemove.asp Link to comment Share on other sites More sharing options...
artem_niko Posted November 30, 2022 Author Share Posted November 30, 2022 2 minutes ago, Sherzod said: https://www.w3schools.com/jsref/event_onmouseover.asp https://www.w3schools.com/jsref/event_onmousemove.asp Well, the first link is not exactly what I need... the second link, yes, something like that. But, will it work if the mouse cursor is over another component, for example, which is in a UniFrame? Link to comment Share on other sites More sharing options...
Sherzod Posted November 30, 2022 Share Posted November 30, 2022 13 minutes ago, artem_niko said: But, will it work if the mouse cursor is over another component, for example, which is in a UniFrame? Yes, it will work. Link to comment Share on other sites More sharing options...
artem_niko Posted November 30, 2022 Author Share Posted November 30, 2022 1 minute ago, Sherzod said: Yes, it will work. And how apply second link? Link to comment Share on other sites More sharing options...
Sherzod Posted November 30, 2022 Share Posted November 30, 2022 16 minutes ago, artem_niko said: the second link, yes, something like that. If you want to handle an event on the server side, then it will send a lot of requests. Link to comment Share on other sites More sharing options...
artem_niko Posted November 30, 2022 Author Share Posted November 30, 2022 2 minutes ago, Sherzod said: If you want to handle an event on the server side, then it will send a lot of requests. Well, if it can be done on the client side, then it would be better. The question is how to apply this code simply Link to comment Share on other sites More sharing options...
Sherzod Posted November 30, 2022 Share Posted November 30, 2022 14 minutes ago, artem_niko said: Well, if it can be done on the client side, then it would be better. The question is how to apply this code simply For example, try. In your frame, on the OnCreate event, the event will be sent to the owner form (you can also configure the buffer config, which will invoke the event after the specified time...) Self.ClientEvents.ExtEvents.Values['afterrender'] := 'function afterrender(sender, eOpts){sender.on("mousemove", function(){ajaxRequest('+ Self.OwnerWebForm.JSName +', "_mousemove", {frameName: "'+ Self.Name +'"})})}'; 1 Link to comment Share on other sites More sharing options...
Sherzod Posted November 30, 2022 Share Posted November 30, 2022 With buffer config (1000 ms): Self.ClientEvents.ExtEvents.Values['afterrender'] := 'function afterrender(sender, eOpts){sender.on({mousemove: function(){ajaxRequest('+ Self.OwnerWebForm.JSName +', "_mousemove", {frameName: "'+ Self.Name +'"})}, buffer: 1000})}'; Link to comment Share on other sites More sharing options...
artem_niko Posted November 30, 2022 Author Share Posted November 30, 2022 1 hour ago, Sherzod said: {frameName: "'+ Self.Name +'"} It turns out that the name of the frame will be sent when the mouse moves within it? Link to comment Share on other sites More sharing options...
artem_niko Posted November 30, 2022 Author Share Posted November 30, 2022 1 hour ago, Sherzod said: Self.OwnerWebForm.JSName What does OwnerWebForm mean here? When you hover the mouse, it says that this is TUniBaseJSForm. Is this the MainForm of the main application? Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now