Inspector issue about draw Button(s) on top of EditorGUI fields, and "CLICK" on it.

here is the story,

I tried to create the auto complete popup for my Editor tools kit.

as the images shown, when the “popup” that I make show on top of another EditorGUI.

![alt text][1]

I assume it’s some kind of bug for inspector, but I’m not sure if I use it correctly.

what’s the point that allow developer to draw button on top of something,

but not allow to click on it ?

Problem:

I can’t really click on the “Top” button,

What happen ?

single mouse click will focus the EditorGUI.TextField behind it.

What should happen

Click on the button ! and run the script within the session.

in this case:

  • if any textfield are lay behind the button, mouse click will focus on the textfield “Behind” it,
    instead of the button on “Top” of it.
  • Cursor (Mouse), it also display as a Cursor.Text instead of Cursor.Hand
  • The popup working fine, if there is nothing allow to interact behind.

some article are saying the GUI.Depth are used to solve the issue, however it didn’t work on my cases.
in editor I mean.
here is how I implement it.

// Draw recommend keyward(s)
if (m_CacheCheckList.Count > 0)
{
    int cnt = m_CacheCheckList.Count;
    float height = cnt * EditorGUIUtility.singleLineHeight;
    Rect area = position;
    area = new Rect(area.x, area.y - height, area.width, height);
    GUI.depth-=10;
    // GUI.BeginGroup(area);
    // area.position = Vector2.zero;
    GUI.BeginClip(area);
    Rect line = new Rect(0, 0, area.width, EditorGUIUtility.singleLineHeight);
 
    for (int i = 0; i < cnt; i++)
    {
        if (GUI.Button(line, m_CacheCheckList*))//, EditorStyles.toolbarDropDown))*

{
rst = m_CacheCheckList*;
GUI.changed = true;
GUI.FocusControl(“”); // force update
_
}_
line.y += line.height;
_
}_
GUI.EndClip();
_
//GUI.EndGroup();_
GUI.depth+=10;
_
}_
so any idea how to workaround the problem ?
for anyone who interested to review the full source code,
there is the link in my blog.
_
[Unity3D Editor TextField AutoCompelete – Clonefactor][2]_
_

_
[1]: https://forum.unity3d.com/attachments/editorgui_issue-gif.242652/
_
[2]: http://www.clonefactor.com/wordpress/public/1769/*_

Since I can’t find any other solution, using Event.current and did the math,
seems it’s the only way that I can do.

my solution was using Event.current.mousePosition to calculate which option are hover by mouse.
and cache the reference, until that field detected focus lost (blur)
script will looking into the cache to find out which one should be selected & replace if needed.

however, the click event still directly land on the TextField behind of it
(that’s the issue I can’t fixed)
and still waiting for the correct answer appear.

99910-editorautocompletev2.gif

the upgraded source code is here.
http://www.clonefactor.com/wordpress/program/c/1809/