tags:

views:

146

answers:

1

What is the proper way to create a custom TMenuItem which auto manage his checked property. Remember that once someone will:

myHelloItem.OnClick := helloword;

Then the behavior is lost...

How is that accomplished in Delphi 7?

regards,

+2  A: 

Two options:

  1. You have an AutoCheck property that makes every click toggle the check-mark for that menu item, regardless of the OnClick behavior (although I believe the OnClick implementation can override AutoCheck). Nevertheless it limits functionality.
  2. You can inherit TMenuItem and implement your desired behavior in the Click method, the one that calls "OnClick"
Roee Adler
Delphi 5 TItemMenu doesn't have AutoCheck property....
maozet
@maozet: I asked on the main post whether it's 5 or 7, because you mention 7 in the body. In this case I would recommend option 2...
Roee Adler