Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

tElMenuItem.Checked dysfunctional with tElMenuBar?

Hello LMD team,

I've just noticed that property "checked" of tElMenuitem becomes completely broken if you use tElMainMenu together with a tElMenuBar.  It works fine without the tElMenuBar.


I have a form with two labels plus a telMainMenu with a menu item "test", having two subitems "mi_yes" and "mi_no".
On the form, I also put a telMenuBar.

I assign an event handler to the "onclick" event of both mi_yes and mi_no.  

object ElMenuItem1: TElMenuItem
      Caption = 'Test'
      object mi_Yes: TElMenuItem
        AutoCheck = True
        Caption = 'Yes'
        Checked = True
        GroupIndex = 1
        RadioItem = True
        OnClick = mi_YesClick
      end
      object mi_No: TElMenuItem
        AutoCheck = True
        Caption = 'No'
        GroupIndex = 1
        RadioItem = True
        OnClick = mi_YesClick
      end
    end


event handler:

procedure TForm1.mi_YesClick(Sender: TObject);
begin
 if mi_yes.checked then label1.caption:='YES is checked' else label1.caption:='YES is NOT checked';
 if mi_no.checked then label2.caption:='NO is checked' else label2.caption:='NO is NOT checked';
end;


I have also noticed that "sender" is neither mi_yes nor mi_no!

Comments

Sign In or Register to comment.