Board index » cppbuilder » PopupMenu question

PopupMenu question


2003-10-17 06:09:14 PM
cppbuilder4
A single popup menu is used by different controls on several dynamically
created forms. In order to find the control which activated one of menu
items, the PopupComponent property of popup menu is used.
Everything is fine when I access popup menu with right mouse button. But if
instead of activating menu by mouse click I simply press hotkey which
corresponds to necessary popup menu item - the proper event fires, but the
PopupComponent property of popup menu (pointer to which is extracted from
Sender parameter of the event) is NULL and thus I can not not identify the
component which activated the menu (if I activate popup menu by mouse at
least once, then subsequent hotkey activations for the same control work
fine) .
What do I misunderstand and how to fix it?
Dmitry
 
 

Re:PopupMenu question

Try setting the forms' ActiveControl property in the forms'
constructor or the IDE or the OnActivate event.
~ JD
 

Re:PopupMenu question

Thank you, JD, already tried, nothing changed. When opening the form I
already have focus at needed control and can immediately type in it.
However, pressing popup menu hotkey fires popup menu event with
PopupComponent == NULL.
Dmitry
"JD" < XXXX@XXXXX.COM >wrote: news:3f900178$ XXXX@XXXXX.COM ...
Quote

Try setting the forms' ActiveControl property in the forms'
constructor or the IDE or the OnActivate event.

~ JD

 

{smallsort}

Re:PopupMenu question

Till now I circumvent this issue by defining OnEnter event for each control
which has popup menu assigned and inside this event I write address of the
control to popup menu Tag property. Looks ugly, but works fine :)
Dmitry
"JD" < XXXX@XXXXX.COM >wrote: news:3f900178$ XXXX@XXXXX.COM ...
Quote

Try setting the forms' ActiveControl property in the forms'
constructor or the IDE or the OnActivate event.

~ JD

 

Re:PopupMenu question

For those, who are interested: perfect solution is Screen->ActiveControl,
works like a charm :)
Dmitry
"Dmitry Mikhilov" < XXXX@XXXXX.COM >wrote:
Quote
Till now I circumvent this issue by defining OnEnter event for each
control
which has popup menu assigned and inside this event I write address of the
control to popup menu Tag property. Looks ugly, but works fine :)

Dmitry

"JD" < XXXX@XXXXX.COM >wrote: news:3f900178$ XXXX@XXXXX.COM ...
>
>Try setting the forms' ActiveControl property in the forms'
>constructor or the IDE or the OnActivate event.
>
>~ JD
>