Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 552779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:32:10+00:00 2026-05-13T11:32:10+00:00

I have form with MainMenu and I want to intercept when the user selects

  • 0

I have form with MainMenu and I want to intercept when the user selects a command item from a menu.
This works in Delphi:

type
  TForm1 = class(TForm)
    ... // Memo and MainMenu created
  protected
    procedure WMCommand(var Info: TWMCommand); message WM_COMMAND;
  end;


procedure TForm1.WMCommand(var Info: TWMCommand);
begin
  if (Info.ItemID < 10) then
    Memo1.Lines.Add('WMCommand ' + IntToStr(Info.ItemID));
end;

In MainMenu I added some items and when I select those items from menu then
my Memo1 is filled with:

WMCommand 2
WMCommand 3
WMCommand 3
WMCommand 2
WMCommand 5
...

I ported this application to FPC/Lazarus, but it seems that WM_COMMAND
handler is not called! When I set breakpoint in TForm1.WMCommand in Delphi then Delphi
stopped many times before main form appeared. Lazarus never stopped
on this breakpoint. I think something is broken with WM_COMMAND
in Lazarus, but maybe I don’t know something. Any idea?

I use Lazarus 0.9.28.2 beta with FPC 2.2.4 on WinXP.

EDIT:

Using Winspector I checked that MainMenu generates WM_COMMAND:

WM_COMMAND
    Code: 0
    Control ID: 2
    Control HWND: 0x00000000
    Message Posted
    Time: 09:37:14.0968

I think there is bug in Lazarus/FPC in WM_COMMAND message method handling and I reported it: http://bugs.freepascal.org/view.php?id=15521

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:32:11+00:00Added an answer on May 13, 2026 at 11:32 am

    In a LCL application you have the following layers:

    • Application
    • LCL
    • Widget set Interface (e.g. win32/win64, qt, gtk2, carbon)
    • Widget set

    WM_COMMAND is a winapi message from the widgetset Layer to the Widget Set interface layer. These messages are not passed to the higher layers, having portability in mind, other widget sets don’t produce such messages.

    If you want to capture the message, then you must write non-portable widgetset specific code (winapi code in this case). You can override the windowproc with setwindowlong. See the Lazarus wiki for an example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have form like this: <input type='text' name='people' id='namepeople'> <input type='hidden' name='idpeople' id='idpeople'> <input
I have form with checkboxes loaded from database (I use entity field type). Checkboxes
I have form with multiple input type=radio with text next to them. I want
I have form with user defined filters ( combobox with column names, combobox with
i have form action file in another directory but some file send to this
I have form with few buttons and I want to know what button is
I have form where user submits field. Field can have letters, numbers, and punctuation.
I currently have form that checks if a user has unsubmitted changes when they
How do i show a from that have been hidden using this.Hide(); I have
I have form for file uploading in my website that i check mime-type of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.