Conversation

TrackPopupMenuEx and owner draw

(overview of excerpts from articles in conversation)

Newsgroup: embarcadero.public.delphi.language.delphi.general

# Lines
wrote on 21-Sep-2009:

Does anybody know how to use TrackPopupMenuEx with owner draw Popup menus?
It appears to size and position the menu before the owner draw routines have
executed any DrawItem or MeasureItem code so although the vertical position
is OK the Width is wrong and nothing gets drawn.
11
  
Remy Lebeau (TeamB) replied on 21-Sep-2009:

"Lorne Anderson" <✉hotmail.com> wrote in message
  news:✉forums.codegear.com...
  (snip)

Just call it normally. There is nothing special you have to do to let
  owner-drawing operate correctly.
  (snip)

Then the owner-drawing code is likely buggy to begin with. Can you show the
25
    
Lorne Anderson replied on 21-Sep-2009:

"Remy Lebeau (TeamB)" <✉no.spam.com> wrote in message
    news:✉forums.codegear.com...
    (snip)

The owner draw code is not processed if I launch the popup with
    TrackPopupMenuEx - even with a simple test procedure like this:
    procedure TMainView.DrawItem(Sender: TObject; ACanvas: TCanvas;
60
  
Remy Lebeau (TeamB) replied on 22-Sep-2009:

"Lorne Anderson" <✉hotmail.com> wrote in message
  news:✉forums.codegear.com...
  (snip)

That is because you are passing the wrong HWND to TrackPopupMenuEx(), so all
  of the menu-related window messages get sent to the wrong window and are not
  dispatched to the TMenuItem objects correctly. VCL menus that are based on
58
    
Lorne Anderson replied on 22-Sep-2009:

Many thanks - all working now (and no more TPM_RETURNCMD).
    Lorne
    "Remy Lebeau (TeamB)" <✉no.spam.com> wrote in message
    news:✉forums.codegear.com...
    (snip)
67
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Sat, 23 Nov 2024 19:36:20 UTC
Copyright © 2009-2024
HREF Tools Corp.