Thread Tools Display Modes
07/22/17, 07:09 AM   #1
Greenlander
Join Date: Jul 2017
Posts: 2
Highlight GUI elements when mouse over it

Hey there,

I recently started scripting my first addon snippets 2 days ago but still not familiar with all the possibilities offered by the API. I used to develop a lot on Multi Theft Auto in case anyone knows, which is using a lua API aswell (and I have to say the documentation is a pain in the arse for beginners compared to MTA's since you on mta wiki you had for every function and event an example on how it could be used + all arguments explained and so so ^^)

So I'm currently working on some interface and was creating some drop down buttons and I wanted to highlight the choices on the dropdown menu when hovering your mouse over it without clicking any of them. But I can't find the right solution for detecting which GUI element I'm pointing on.

Anyone here to help me with a neat solution?

Regards,
Green
  Reply With Quote
07/22/17, 07:16 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by Greenlander View Post
Hey there,

I recently started scripting my first addon snippets 2 days ago but still not familiar with all the possibilities offered by the API. I used to develop a lot on Multi Theft Auto in case anyone knows, which is using a lua API aswell (and I have to say the documentation is a pain in the arse for beginners compared to MTA's since you on mta wiki you had for every function and event an example on how it could be used + all arguments explained and so so ^^)

So I'm currently working on some interface and was creating some drop down buttons and I wanted to highlight the choices on the dropdown menu when hovering your mouse over it without clicking any of them. But I can't find the right solution for detecting which GUI element I'm pointing on.

Anyone here to help me with a neat solution?

Regards,
Green
The controls have an OnMouseEnter/OnMouseExit event. I case you create them, you can listen to that event.

The sledgehammer method is to use the moc() function (MouseOverControl)
Lua Code:
  1. function moc()
  2.     return WINDOW_MANAGER:GetMouseOverControl()
  3. end
  Reply With Quote
07/22/17, 07:25 AM   #3
Greenlander
Join Date: Jul 2017
Posts: 2
Aye exactly what I was searching for. Thanks a lot

Seems like I interpreted OnMouseEnter as mouse click event
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Highlight GUI elements when mouse over it

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off