?
Solved

How to hide a popupmenu with a code?

Posted on 1998-04-11
5
Medium Priority
?
253 Views
Last Modified: 2011-09-20
There are methods for destroying
the menu, but how to just hide it?
0
Comment
Question by:raunol
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:inter
ID: 1361404
Hi,
Let pm be a tpopupmenu, does the following work?
  ShowWindow(pm.handle, SW_HIDE);
Igor
0
 

Author Comment

by:raunol
ID: 1361405
No, Igor, it doesen't. I have tried that.
I want to hide open popupmenu in OnTimer -event.
If I use menu.free or menu.destroy functions the
menu do disapear but destroing the same.

Is there any way only hide it? Perhaps some code
could imitate mouse or keyboard-Click so that the
menu hides like normally?

But if there's not, it is welcome wice too,
how to bild fully functional identical menu
again, after destroying.

- Rauno
0
 
LVL 5

Accepted Solution

by:
inter earned 200 total points
ID: 1361406
Please insert the following in your timer routine:

  PostMessage(Handle, WM_LBUTTONDOWN,MK_LBUTTON,0);
  PostMessage(Handle, WM_LBUTTONUP,MK_LBUTTON,0);

The problem is that popup menu is tracked with TrackPopupMenu which doesnot return until a menu is selected, clicked on other components or a special key is pressed

Regards,
Igor
0
 
LVL 1

Expert Comment

by:pjdb
ID: 1361407
I suggest to send an escape key with the following code

keybd_event(vk_escape, $45, keyeventf_extendedkey or 0, 0);
keybd_event(vk_escape, $45, keyeventf_extendedkey or keyeventf_keyup, 0);

I think it's better since the click can occur on any control and can cause an undesired action.

JDB
0
 

Author Comment

by:raunol
ID: 1361408
Thank's Igor and JDB.

Both solutions are very good.
I should like to grade half of points for both of
You, but I don't know how this system works, I have
used this a short time. It seems to give me a
possibility to grade only the first answer.

But - If I may to put them the order - Postmessage
seems a little bit better for my meanings in this
time, because keaboard action - for some reasons -
causes the menu quicly flash ones, before it disapear,
but Postmessage don't. And also, JDB, postmessage-click
occurs only the handle points and in this case it
causes any problems for me.

However, Thanks wery much you too, JDB. Also Your
solution was good and works. I'm sorry about points.

BTW, I Should want to delete my difficult
Opendialog-Handle guestion and "save" my few
points ;-)
But I don't find any options to do so. Have
You any adwices about that?

Regards

- Rauno

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question