Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How can I hide a pop-up menu?

Posted on 2000-03-14
15
Medium Priority
?
204 Views
Last Modified: 2013-11-28
I can call "Popup" to bring up a pop-up menu. Then how can I hide the pop-up menu using any method or function?

Notice: I didn't like it cause the pop-up menu disapears to simulate a user clicks mouse.
0
Comment
Question by:Dantry
[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
  • 6
  • 5
  • 2
  • +2
15 Comments
 

Expert Comment

by:johnwa
ID: 2619018
you can just set all the items's Visible property of the popmenu  to false.
0
 
LVL 4

Expert Comment

by:jeurk
ID: 2619022
Hello, I don't understand what you want.
Is your problem maybe related with the popup menu of a tray icon ?
0
 
LVL 9

Expert Comment

by:ITugay
ID: 2619091

procedure HidePopUpMenu(PP : TPopupMenu);
begin
      Popuplist.Remove(PP);
      PopupList.Add(PP);
end;

Best regards,
Igor.
0
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.

 

Author Comment

by:Dantry
ID: 2621838
Hello Johnwa!

I couldn't set all the items's Visible property of the popmenu to false because every item has own status about visible or disvisible.

And your advice is very cockamamie when the menu has many items and the operator about setting popup or hiding is frequent.

Thanks for helping me! I hope to see you again in the experts-exchange.
0
 

Author Comment

by:Dantry
ID: 2626174
All above answers couldn't help me.

If you try the first method of set all menuitems' visible property equate FALSE, you will find although all menuitems disapear some small popup menu still exist. Please try!

The ITugay's method I couldn't go deep into understanding. In Delphi 3.0, the Remove method can be used by the TList, TMenuItem and TThreadItem objects. All of them refuse the TPopupMenu Parameter.

Thanks for your help. But I don't gain a feasible method.
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 300 total points
ID: 2626212
How about sending the popup an ESC char, like this:

SendMessage(Popup.handle, WM_CHAR, VK_ESC, 0);

(or should that be ..., 0, VK_ESC) ? )

Cheers,

Raymond.
0
 

Author Comment

by:Dantry
ID: 2626346
Raymond:

Hi! You give me a good suggestion to use API. I already try but the popup menu seem not to receive the message.

Please confirm the second parameter. Oh, can do you help me again? It is my expectancy.

When I scan your profile, I very glad to find a eldership in GIS and GPS. Can I record your address and bother you sometimes?

                        friendly,
                         Dantry
               
0
 
LVL 9

Expert Comment

by:ITugay
ID: 2626990
to Dantry,

There is difficulties. Popupmenu1.Popup(X,Y) is working like ShowModal.

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
   Popupmenu1.Popup(100,100);
   Application.ProcessMessages; // set breakpoint here and see what happen
end;

My solution is working when Popup(X,Y) and HidePopUpMenu is called from different threads. I'm not sure that it will work in D3. Is it possible to show code you use to check our samples.

About my method:

------------- Delphi help --------------
Use PopupList to access all the popup menus in the application or access the window handle of the window that responds to popup menu messages. PopupList maintains a list of all the popup menu components created in an application. It holds the handle of a hidden window that centralizes the processing of Windows messages directed at these popup menus.
------------

If you remove PopupMenu from PopupList, it MUST close popup menu window. May be it help somebody to make solution for you.

Cheers,
Igor.

PS: PopupList inherits from TList.
0
 

Author Comment

by:Dantry
ID: 2627132
Hi, my friends, I already find a easy way to disappear a pop-up menu. Let us share the result.

When the pop-up menu in the main form:
    PostMessage(Handle, WM_KEYDOWN, VK_ESCAPE, 0);

I must thank Raymond again for his(her) idea. But it is noticed that the escape message have to the parent of the pop-up menu. In the example, the first parameter is the main form's handle because it is the pop-up menu's parent.

Please try again, you will accept the result.

0
 

Author Comment

by:Dantry
ID: 2627143
Raymond:

Hello!
Thanks. Hope meet you again.

friendly,
Dantry
0
 
LVL 9

Expert Comment

by:ITugay
ID: 2627148
it look like points for Raymond;-)
0
 

Author Comment

by:Dantry
ID: 2627192
Oh, I'm mazed by the experts-exchange.
Why it display 'Points: 10' in the end?
How many points did I give Raymond?
Why do I have 115 points?

Help! ITugay, are you tell me the detail rules about the game? Can I dispatch the points to several men?
0
 
LVL 9

Expert Comment

by:ITugay
ID: 2627267
10 points * 4(A excelent) = 40
                * 3(B good) = 30 to Raymond.
etc.  

To tell you trust, it must be approx from 50 to 150 points for you question (not 10).

To dispatch points to Raymond you need ask a question: "points to rwilson".
Then Raymond send comments (Hello!), and you accept comments as answer.

Cheers,
Igor.

0
 
LVL 9

Expert Comment

by:ITugay
ID: 2627280
I miss something, it was 100 points at first (not 10, sorry) and 10 points on the end. It is remaining price of you question after it answered.


Igor.
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2630213
Hi Dantry,

Thanks for the points. My email address is raymond.wilson@trimble.co.nz, or ripplesoftware@hotmail.com.

Cheers,

Raymond.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Owning a franchise can be the dream of a lifetime. It provides a chance for economic growth. You can be as successful as you want.  To make your franchise successful, you need to market it successfully. Here are six of the best marketing strategies …
Whoever said that “a picture is worth one thousand words” observed a fact that can dramatically affect your marketing success. Most people tend to learn visually, so many publishers commonly acknowledge the effectiveness of visual learning by using…
An overview of how to create reports in Adobe Analytics (formerly Omniture Site Catalyst) using pageNames, events, eVars and props. This video will show you how to install the Omniture Debugger tool so can see (and test) what is being passed int…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
Suggested Courses

609 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