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. Quote 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... Quote 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. Quote 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? Quote 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 Quote 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 Quote 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? Quote 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. Quote 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? Quote 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. Quote 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 Quote 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 Quote 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})}'; Quote 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? Quote 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.