Board index » cppbuilder » Tpopup onpopup event and Popup method

Tpopup onpopup event and Popup method


2005-05-04 03:11:25 AM
cppbuilder109
Hi, I would like to know if the OnPopup event is synchronized with the
Popup method of the TPopup menu.
I ask this question because I do a lot of menu reorganisation in the
OnPopup event and the menu gets partially displayed and it causes the
popup menu to flash. I am trying to subclass the Popup menu and use the
TCritical section to make sure the Popup(x,y) method will only call
TPopupMenu::Popup(x,y); after the TCritical section has been release
from the OnPopup Event.
Thank you for any help
Simon
 
 

Re:Tpopup onpopup event and Popup method

"Simon Guertin" < XXXX@XXXXX.COM >wrote in message
Quote
Hi, I would like to know if the OnPopup event is synchronized
with the Popup method of the TPopup menu.
The OnPopup event is triggered by the Popup() method itself. This is to
allow the application to make any desired changes to the menu items before
they are displayed.
Quote
I ask this question because I do a lot of menu reorganisation in
the OnPopup event and the menu gets partially displayed
The menu is not displayed until after the OnPopup event handler exits.
Quote
I am trying to subclass the Popup menu
For what purpose exactly? What is wrong with using the native TPopupMenu
as-is?
Quote
and use the TCritical section to make sure the Popup(x,y) method will
only call TPopupMenu::Popup(x,y); after the TCritical section has been
release from the OnPopup Event.
Why are you using a TCritcalSection at all? You are not trying to access
the TPopupMenu from multiple threads at the same time, are you? If so, then
you should not be doing that to begin with.
Please provide more details.
Gambit
 

Re:Tpopup onpopup event and Popup method

I just found out that the OnPopup event is after the Popup(x,y) method
and I also saw that it is useless to use TCritical Section.
In the Onpopup Method, I do a lot of new MenuItems and reinsert them in
some other menu items (I do some MenuItem.Clear() just before) to
regererate the actions according to the state of the application. I
think that is why the popup menu is "flashing". When I mean flashing, I
want to say the menu is drawn like a grey box and seems to open and
close in a very fast manner before being displayed correctly.
I think I will need to regenerate at another time in the application and
only enable/disable the menu items in the OnPopup event.
thank you
Simon
Remy Lebeau (TeamB) wrote:
Quote
"Simon Guertin" < XXXX@XXXXX.COM >wrote in message
news:4277ccd5$ XXXX@XXXXX.COM ...


>Hi, I would like to know if the OnPopup event is synchronized
>with the Popup method of the TPopup menu.


The OnPopup event is triggered by the Popup() method itself. This is to
allow the application to make any desired changes to the menu items before
they are displayed.


>I ask this question because I do a lot of menu reorganisation in
>the OnPopup event and the menu gets partially displayed


The menu is not displayed until after the OnPopup event handler exits.


>I am trying to subclass the Popup menu


For what purpose exactly? What is wrong with using the native TPopupMenu
as-is?


>and use the TCritical section to make sure the Popup(x,y) method will
>only call TPopupMenu::Popup(x,y); after the TCritical section has been
>release from the OnPopup Event.


Why are you using a TCritcalSection at all? You are not trying to access
the TPopupMenu from multiple threads at the same time, are you? If so, then
you should not be doing that to begin with.

Please provide more details.


Gambit


 

{smallsort}

Re:Tpopup onpopup event and Popup method

"Simon Guertin" < XXXX@XXXXX.COM >wrote in message
Quote
I just found out that the OnPopup event is after the Popup(x,y)
method
Popup() calls OnPopup. OnPopup is not triggered after Popup().
Quote
In the Onpopup Method, I do a lot of new MenuItems and reinsert
them in some other menu items (I do some MenuItem.Clear() just before)
to regererate the actions according to the state of the application.
In a descendant, the best place to do that is to override the virtual
DoPopup() method.
Gambit