Solved

How can I hide a pop-up menu?

Posted on 2000-03-14
15
192 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
 

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Read about why website design really matters in today's demanding market.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now