Solved

How can I hide a pop-up menu?

Posted on 2000-03-14
15
195 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
  • 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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 100 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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Read about how to approach blogging and about ways to do it right. Stand out from the crowd and let your knowledge be consumed by a large audience. This article aims to explain how your blog should look like,  the most important things to do while b…
Digital marketing agencies have encountered both the opportunities and difficulties that emerge from working with a wide-ranging organizations.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
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…

809 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