# Displaying a menu

**URL:** <https://forum.xojo.com/t/displaying-a-menu/13121>\
**Category:** General\
**Created:** [December 20, 2013, 10:08pm UTC](https://forum.xojo.com/t/displaying-a-menu/13121 "2013-12-20T22:08:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oliver\_Scott-Brown](https://forum.xojo.com/letter_avatar_proxy/v4/letter/o/8baadc/32.png) [@Oliver\_Scott-Brown](https://forum.xojo.com/u/Oliver_Scott-Brown)\
**Post date:** [December 20, 2013, 10:08pm UTC](https://forum.xojo.com/t/displaying-a-menu/13121/1 "2013-12-20T22:08:57Z")

</div>

How could I go about displaying a menu with submenus? I want it to go under a textfield. I could use a combobox but the problem is, I do not think you can use submenus with them.

Here is a screenshot of the sort of thing that I am trying to achieve:  
[https://www.dropbox.com/s/0ucjxefpln2ncx4/Untitled.png](https://www.dropbox.com/s/0ucjxefpln2ncx4/Untitled.png)

Thanks

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [December 20, 2013, 10:10pm UTC](https://forum.xojo.com/t/displaying-a-menu/13121/2 "2013-12-20T22:10:12Z")

</div>

Create a Contextual Menu from the appropriate event in your Textfield

---

<div class="post-metadata">

**Author:** ![Oliver\_Scott-Brown](https://forum.xojo.com/letter_avatar_proxy/v4/letter/o/8baadc/32.png) [@Oliver\_Scott-Brown](https://forum.xojo.com/u/Oliver_Scott-Brown)\
**Post date:** [December 20, 2013, 10:12pm UTC](https://forum.xojo.com/t/displaying-a-menu/13121/3 "2013-12-20T22:12:46Z")

</div>

Oops the forum has made a duplicate post. Here is my newer thread with a little more info on what I am trying to achieve. Thanks

---

<div class="post-metadata">

**Author:** ![Oliver\_Scott-Brown](https://forum.xojo.com/letter_avatar_proxy/v4/letter/o/8baadc/32.png) [@Oliver\_Scott-Brown](https://forum.xojo.com/u/Oliver_Scott-Brown)\
**Post date:** [December 20, 2013, 10:14pm UTC](https://forum.xojo.com/t/displaying-a-menu/13121/4 "2013-12-20T22:14:27Z")

</div>

> [@54247:@Dave S](#):
>
> Create a Contextual Menu from the appropriate event in your Textfield

The problem with this is that it positions it exactly where the mouse is and it does not respond to the left mouse button.

Thanks

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [December 20, 2013, 10:46pm UTC](https://forum.xojo.com/t/displaying-a-menu/13121/5 "2013-12-20T22:46:19Z")

</div>

You do not have to use the contextual menu as-is. Or put another way, you can co-opt the contextual menu handlers, or bypass them altogether.

MenuItem has a PopUp method that you can call to display the menu wherever you want. So construct a menu (you can create a subclass of EditField and call ConstructContextualMenu from Mousedown, for example) and pop it up in MouseDown.

(This also answers your other question about how to have a menu display in response to a left click.)

---

<div class="post-metadata">

**Author:** ![Oliver\_Scott-Brown](https://forum.xojo.com/letter_avatar_proxy/v4/letter/o/8baadc/32.png) [@Oliver\_Scott-Brown](https://forum.xojo.com/u/Oliver_Scott-Brown)\
**Post date:** [December 20, 2013, 11:28pm UTC](https://forum.xojo.com/t/displaying-a-menu/13121/6 "2013-12-20T23:28:00Z")

</div>

[quote=54259:@Tim Hare]You do not have to use the contextual menu as-is. Or put another way, you can co-opt the contextual menu handlers, or bypass them altogether.

MenuItem has a PopUp method that you can call to display the menu wherever you want. So construct a menu (you can create a subclass of EditField and call ConstructContextualMenu from Mousedown, for example) and pop it up in MouseDown.

(This also answers your other question about how to have a menu display in response to a left click.)[/quote]  
Thanks!!

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 4:59pm UTC](https://forum.xojo.com/t/displaying-a-menu/13121/7 "2020-10-29T16:59:34Z")

</div>


