Locations of special menu items

58 views
Skip to first unread message

nis

unread,
Dec 12, 2016, 11:04:53 PM12/12/16
to eto-...@googlegroups.com
Hi.

Eto.Forms' MenuBar has some special items.
(ApplicationItems, QuitItem, AboutItem...)

Currently they seem to be located in fixed parent-menu.
(ApplicationItems and QuitItems are placed in "File",
AboutItem is placed in "Help")

I want Eto applications internationalized,
so English words such as "File" or "Help" must also be localized.
But in my case...

## Sample code

Menu = new MenuBar
{
Items =
{
new ButtonMenuItem { Text = "&Expediente", Items = { clickMe } },
},
ApplicationItems =
{
new ButtonMenuItem { Text = "&Preferences..." },
},
QuitItem = quitCommand,
AboutItem = aboutCommand
};

## Result

Windows(WPF) : "File" and "Help" are generated along with "Expediente".
Linux(GTK+3) : Launch failed

## Requirement

I want Eto.Forms allow localized menu items,
maintaining special items' functionalities.

## Exception on linux

$ mono EtoTest03_shown_filemenu.Desktop.exe

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at Eto.GtkSharp.Forms.GtkControl`3[TControl,TWidget,TCallback].AttachEvent (System.String id) <0xb2fb8ae8 + 0x00d7a> in <filename unknown>:0
at Eto.WidgetHandler`1[TWidget].HandleEvent (System.String id, Boolean defaultEvent) <0xb2feda78 + 0x00162> in <filename unknown>:0
at Eto.Widget.HandleEvent (System.String id) <0xb2fb8980 + 0x000a3> in <filename unknown>:0
at Eto.PropertyStore.AddHandlerEvent (System.String key, System.Delegate value) <0xb2fb8848 + 0x000c7> in <filename unknown>:0
at Eto.Forms.Control.add_Shown (System.EventHandler`1 value) <0xb2fb8808 + 0x0002f> in <filename unknown>:0
at EtoTest03_shown_filemenu.MainForm..ctor () <0xb5207550 + 0x0021f> in <filename unknown>:0
at EtoTest03_shown_filemenu.Desktop.Program.Main (System.String[] args) <0xb71aded0 + 0x0005b> in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
at Eto.GtkSharp.Forms.GtkControl`3[TControl,TWidget,TCallback].AttachEvent (System.String id) <0xb2fb8ae8 + 0x00d7a> in <filename unknown>:0
at Eto.WidgetHandler`1[TWidget].HandleEvent (System.String id, Boolean defaultEvent) <0xb2feda78 + 0x00162> in <filename unknown>:0
at Eto.Widget.HandleEvent (System.String id) <0xb2fb8980 + 0x000a3> in <filename unknown>:0
at Eto.PropertyStore.AddHandlerEvent (System.String key, System.Delegate value) <0xb2fb8848 + 0x000c7> in <filename unknown>:0
at Eto.Forms.Control.add_Shown (System.EventHandler`1 value) <0xb2fb8808 + 0x0002f> in <filename unknown>:0
at EtoTest03_shown_filemenu.MainForm..ctor () <0xb5207550 + 0x0021f> in <filename unknown>:0
at EtoTest03_shown_filemenu.Desktop.Program.Main (System.String[] args) <0xb71aded0 + 0x0005b> in <filename unknown>:0

curtis

unread,
Feb 1, 2017, 11:31:00 AM2/1/17
to Eto.Forms
Hi Jirou,

There's no way to internationalize the special item menu headers at this point, which will need some extra api to accomplish.

Please file an issue on GitHub so I can schedule this in the roadmap.

Cheers!
Curtis.

nis

unread,
Jun 6, 2017, 11:55:42 PM6/6/17
to eto-...@googlegroups.com
Hi Curtis,

I recently saw Eto's code and found it possible now (at least 2.3).

```cs
MenuBar Menu;
// 'Menu' constructor
Menu.ApplicationMenu.Text = "&Expediente";
Menu.HelpMenu.Text = "&Ayuda";
```

This worked on Windows(WPF) and Linux(GTK#3).

Thanks, curtis!

curtis

unread,
Jun 9, 2017, 4:17:41 AM6/9/17
to Eto.Forms

Awesome!  That's a great way to do that.
Reply all
Reply to author
Forward
0 new messages