Eto: Questions about porting to Eto

Created on 16 Jun 2017  ·  5Comments  ·  Source: picoe/Eto

Hello!

I'm porting my program to the Eto framework and during the porting and debugging of the interface I have the following questions:

  1. Is there a way to disable scaling of images in buttons (Button) and why is it enabled by default?

  2. Why is when the button is set to Enabled = false, the button becomes pale, and the icon remains bright? How can this be fixed (WPF-mode)?

  3. Why in the WinForms mode buttons of the toolbar do not scale to the size of the pictures - less real image size is output? Because of this, the images are less than the actual size and blurry.

  4. Why are there absolutely no status bars and what are the options for replacing them, if they are really needed (Panel + Labels?).

  5. How correctly to implement CustomControl which should unite properties Drawable and Scrollable components? I made an attempt to make them a hybrid, but it did not work. Will Drawable be nested in Scrollable? Or is there a better solution?

  6. Is there a way to set the alignment of values ​​in the GridView columns?

  7. How can I get the current active application window (if there are several SDI document windows that are equal in rights)?

  8. Do you plan to create an engine like NUnitForms in the future - to test UI applications?

  9. In WPF mode, if ClientSize is not assigned to the dialog, everything is perfectly aligned with the specified layout, and the dialog itself takes a good size. However, in WinForms mode the dialog turns out to be small and the components do not line up properly. WinForms - supported as a platform?

Can you help me?

Most helpful comment

Hey,

I think you should open separate issues for each of your problems, I can only answer a few points of yours.
Eto does not aim to act the same way on all platforms (as @cwensley said in some of the issues that were raised), it's main aim is to look and act native on each platform, that's the main reason of your problems. You can solve some of them by using Styling

  1. This is solvable using Styling
  2. I think this is related to this issue and I think it's solvable by styling.
  3. Because it's the default WinForms behavior (as far as I remember when worked with winforms) solvable by styling
  4. Not all platforms has/supports StatusBar, if I need one, as you said, I make stacked layout with items in it.
  5. Why don't you just put Drawable to Scrollable layout and make Drawable control as big as you want?
  6. TextBoxCell has a property called TextAlignment and VerticalAlignment:
    C# new GridColumn() { HeaderText = header, DataCell = new TextBoxCell() { Binding = binding, TextAlignment = TextAlignment.Center, VerticalAlignment = VerticalAlignment.Center }, };
  7. You already have an answer for that

All 5 comments

Hey,

I think you should open separate issues for each of your problems, I can only answer a few points of yours.
Eto does not aim to act the same way on all platforms (as @cwensley said in some of the issues that were raised), it's main aim is to look and act native on each platform, that's the main reason of your problems. You can solve some of them by using Styling

  1. This is solvable using Styling
  2. I think this is related to this issue and I think it's solvable by styling.
  3. Because it's the default WinForms behavior (as far as I remember when worked with winforms) solvable by styling
  4. Not all platforms has/supports StatusBar, if I need one, as you said, I make stacked layout with items in it.
  5. Why don't you just put Drawable to Scrollable layout and make Drawable control as big as you want?
  6. TextBoxCell has a property called TextAlignment and VerticalAlignment:
    C# new GridColumn() { HeaderText = header, DataCell = new TextBoxCell() { Binding = binding, TextAlignment = TextAlignment.Center, VerticalAlignment = VerticalAlignment.Center }, };
  7. You already have an answer for that

I'm embarrassed for asking but I'm not able to solve "Is there a way to disable scaling of images in buttons (Button) and why is it enabled by default?" with Styles as suggested by @SlowLogicBoy.
The farest I've been able to go is:

Style.Add<Eto.Wpf.Forms.Controls.ButtonHandler>(null, handler => ?????? ));

Can you provide an example on how you do it?
Thanks

I'm not familiar with wpf, so this is what I can give you:

using swc = System.Windows.Controls;

Style.Add<Eto.Wpf.Forms.Controls.ButtonHandler>(null, handler => {
    var grid = handler.Control.Content as swc.Grid;
    if(grid == null) return; //Something in ButtonHandler changed

    var imageCtrl = grid.GetChildOfType<swc.Image>().SingleOrDefault();
    if(imageCtrl == null) return; //Something in ButtonHandler changed

    //TODO: Stuff with imageCtrl
});

static IEnumerable<T> GetChildOfType<T>(this swc.Grid self)
{
    foreach (var item in self.Children)
    {
        if(item is T ctrl)
            yield return ctrl;
    }
}

How Eto button is made for wpf

Thanks @SlowLogicBoy, your code is definitely a good starting point to gain access to the Wpf Button, I'll try to go on and find out how to disable the scaling on my own :)

For the records, the following snippet does the job:

Style.Add<Eto.Wpf.Forms.Controls.ButtonHandler>(null, handler =>
{
    var grid = handler.Control.Content as swc.Grid;
    if (grid == null)
        return;
    var image = grid.Children.OfType<swc.Image>().FirstOrDefault();
    if (image == null)
        return;
    image.Stretch = System.Windows.Media.Stretch.None;
});

Thanks @SlowLogicBoy for his help

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ArsenShnurkov picture ArsenShnurkov  ·  17Comments

Jojatekok picture Jojatekok  ·  33Comments

Sanae6 picture Sanae6  ·  4Comments

jzlhll picture jzlhll  ·  14Comments

azunyuuuuuuu picture azunyuuuuuuu  ·  23Comments