Events not fired in MenuBar

1
0

Why events like Click, MouseDown, MouseClick, MouseEnter are not fired in the MenuBar component? What am I missing to do?

  • You must to post comments
1
1

Hi Sergio,

That’s actually correct, the MenuBar should not trigger those events, since it’s a Menu.

You still have access to the MenuItemClick event and any other event associated with a MenuItem.

May I ask why you would need to use those Pointer events in particular?

Best,
Alaa

  • Sergio Granzzotto
    Hi Alaa! The long answer is: It’s because when maximizing the form on the desktop, I choose to hide the title bar (FormBorderStyle = None). Thus, the menu bar (whether MainMenu or MenuBar) becomes a pseudo title bar. When double-clicking on it, the form returns to its normal state (WindowState = Normal, also changing the title bar visible via FormBerderStyle = Sizeable), that is, MainMenu or MenuBar with the same behavior as when double-clicking on the title bar. The short answer: It’s because there are events that I could use… (lol) I wondered if there was any way to intercept (addhandling) the mouse click or double click on a specific area of the screen, and when it was on the MenuBar (or MainMenu), I could perform the maximize/normal procedure, once these events don’t work properly in MenuBar. Best wishes, Sérgio
  • Alaa (ITG)
    Well, Fortunately for you, with Wisej.NET you can do just that! Add the code below to your Form Load event handler, or better yet if you’re going to use the same behavior in more than one place, I would suggest that you extend the MenuBar component in another class and call it when it’s initialized! this.menuBar1.Eval(@” this.addListener(“”pointerup””, (e)=>this.fireEvent(“”mouseup””), this); this.addListener(“”pointerout””, (e)=>this.fireEvent(“”mouseout””), this); this.addListener(“”pointerover””, (e)=>this.fireEvent(“”mouseover””), this); this.addListener(“”pointerdown””, (e)=>this.fireEvent(“”mousedown””), this); this.addListener(“”click””, (e)=>this.fireEvent(“”click””), this); this.addListener(“”dbltap””, (e)=>this.fireEvent(“”dblclick””), this);”); Make sure to double check the object name and the quotations as the forum has its own special way of dealing with quotes :)
  • Sergio Granzzotto
    Awesome! It’s working fine right now with these “tricks”! Thank you so much, Alaa! Greetings!
  • You must to post comments
0
0

Hi Alaa,

Se the sample attached. What I noticed is that the events are fired when we click on the border, but clicking inside the MenuBar, nothing happens

Thank you in advance!

Sérgio

Attachment
  • You must to post comments
0
0

Hi Sergio,

Are you sure that everything is wired? I just tried it and it works!

Perhaps you can send me a sample?

Best,
Alaa

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.