Discussion:
Menu events in 1.9.34
(too old to reply)
Allen Murphy
2006-07-24 23:06:44 UTC
Permalink
Greetings!

I have noticed that in the Gambas2 1.9.34 Form Designer, when I click a
menu item I have created, I am not sent to the Code Editor as in Gambas
1.0.17.

For example, if I have a menu named mnuFile with a child item named
itmQuit, I am not sent to the event handler "PUBLIC SUB itmQuit_Click()"
when I click on that item.

Is this by design, or am I missing something?

Thanks,
Allen
Benoit Minisini
2006-07-24 23:27:02 UTC
Permalink
Post by Allen Murphy
Greetings!
I have noticed that in the Gambas2 1.9.34 Form Designer, when I click a
menu item I have created, I am not sent to the Code Editor as in Gambas
1.0.17.
For example, if I have a menu named mnuFile with a child item named
itmQuit, I am not sent to the event handler "PUBLIC SUB itmQuit_Click()"
when I click on that item.
Is this by design, or am I missing something?
Thanks,
Allen
No, this is a bug. Some line of code I commented and forgot to uncomment.
--
Benoit Minisini
Allen Murphy
2006-07-25 00:29:03 UTC
Permalink
I did some snooping around and found the offending commented code.

In file FForm.class located in ../gambas2-1.9.34/app/src/gambas2, I
un-commented lines 1464 to 1468:

PUBLIC SUB Menu_Click()

Control_DblClick

END

This seems to have fixed the problem. I have attached the patched file.
Benoit can verify if I found the right section of problem code.

Take care,
Allen
Post by Benoit Minisini
Post by Allen Murphy
Greetings!
I have noticed that in the Gambas2 1.9.34 Form Designer, when I click a
menu item I have created, I am not sent to the Code Editor as in Gambas
1.0.17.
For example, if I have a menu named mnuFile with a child item named
itmQuit, I am not sent to the event handler "PUBLIC SUB itmQuit_Click()"
when I click on that item.
Is this by design, or am I missing something?
Thanks,
Allen
No, this is a bug. Some line of code I commented and forgot to uncomment.
Allen Murphy
2006-07-25 00:33:45 UTC
Permalink
Sorry, forgot to attach the patch.
Post by Allen Murphy
I did some snooping around and found the offending commented code.
In file FForm.class located in ../gambas2-1.9.34/app/src/gambas2, I
PUBLIC SUB Menu_Click()
Control_DblClick
END
This seems to have fixed the problem. I have attached the patched file.
Benoit can verify if I found the right section of problem code.
Take care,
Allen
Post by Benoit Minisini
Post by Allen Murphy
Greetings!
I have noticed that in the Gambas2 1.9.34 Form Designer, when I click a
menu item I have created, I am not sent to the Code Editor as in Gambas
1.0.17.
For example, if I have a menu named mnuFile with a child item named
itmQuit, I am not sent to the event handler "PUBLIC SUB itmQuit_Click()"
when I click on that item.
Is this by design, or am I missing something?
Thanks,
Allen
No, this is a bug. Some line of code I commented and forgot to uncomment.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
Benoit Minisini
2006-07-25 00:48:01 UTC
Permalink
Post by Allen Murphy
Sorry, forgot to attach the patch.
Post by Allen Murphy
I did some snooping around and found the offending commented code.
In file FForm.class located in ../gambas2-1.9.34/app/src/gambas2, I
PUBLIC SUB Menu_Click()
Control_DblClick
END
This seems to have fixed the problem. I have attached the patched file.
Benoit can verify if I found the right section of problem code.
Take care,
Allen
Actually this is more complex than that.

If you just uncomment the "Menu_Click" sub, then this event handler can be
raised because a true menu is clicked (not one you design in the form editor,
but one of the contextual menu). This is because now the contextual menus
don't have their own event handler anymore, they use Actions, and so an event
handler with the class name is searched. And as the class name is "Menu", the
Menu_Click function is called, and you get an error. Try to remove a control
in the form editor with the DELETE key.

The solution is to replace in CControl.class the code 'Object.Attach(...,
"Menu")' by 'Object.Attach(..., "MenuControl")' and to rename Menu_Click as
MenuControl_Click.

Regards,
--
Benoit Minisini
Allen Murphy
2006-07-25 01:05:11 UTC
Permalink
Thanks for the correction, Benoit. I applied the changes that you
recommended (in CControl.class I changed lines 285 and 311 to read
'Object.Attach(..., "MenuControl")') and fixed the sub in FForm.class
(line 1464 'PUBLIC SUB MenuControl_Click()'). This seems to be working.

Take care,
Allen
Post by Benoit Minisini
Post by Allen Murphy
Sorry, forgot to attach the patch.
Post by Allen Murphy
I did some snooping around and found the offending commented code.
In file FForm.class located in ../gambas2-1.9.34/app/src/gambas2, I
PUBLIC SUB Menu_Click()
Control_DblClick
END
This seems to have fixed the problem. I have attached the patched file.
Benoit can verify if I found the right section of problem code.
Take care,
Allen
Actually this is more complex than that.
If you just uncomment the "Menu_Click" sub, then this event handler can be
raised because a true menu is clicked (not one you design in the form editor,
but one of the contextual menu). This is because now the contextual menus
don't have their own event handler anymore, they use Actions, and so an event
handler with the class name is searched. And as the class name is "Menu", the
Menu_Click function is called, and you get an error. Try to remove a control
in the form editor with the DELETE key.
The solution is to replace in CControl.class the code 'Object.Attach(...,
"Menu")' by 'Object.Attach(..., "MenuControl")' and to rename Menu_Click as
MenuControl_Click.
Regards,
Continue reading on narkive:
Loading...