[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to hide a popupmenu with a code?

Posted on 1998-04-11
5
Medium Priority
?
254 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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 this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

650 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