More Eto Examples please

Not as nice as a drag-and-drop form-layout tool, but I learned several things from your code. Like, maybe I should be using FloatingForms instead of Dialogs (I don’t usually need a result, just need to manipulate geo), the UseRhinoStyle thing (sadly it seems that’s only available in Rhino 8), and that lamda thing.

Thanks.

I’ve also been testing ChatGPT’s UI design capabilities. One thing is for sure, asking it to make a PyQt UI is 100x easier than creating Eto Forms. My limited programming skills may not have made it easy for me, and ChatGPT can still be very stubborn at times. Both Rhino and Eto are niche areas, and I agree that working with Eto is sometimes not trivial. It would be nice to have a lot more Eto examples.

I even thought, what if the discourse community collectively trained some AI assistant to help write Rhino-friendly Eto Forms?
Not that I know how to train such assistants… :wink: but even just having more examples of Eto to shove down Chat’s throat during evening conversations would help a lot.

I will say, my takeaway from reaching these conclusions was this specific section.

And that generating an Eto UI from a text based format, could in theory offer some quite fantastic opportunities.

1 Like

Reminds me of this:

1 Like

Example Eto SVG loader
This example shows a way to

Load svg files into a grid view in different sizes
Combine different layouts
Overlay an image with lines
Embed an SVG into a button
Load content from a url

(with inspiration from @Charles ’ svg viewer)

icon_viewer3.cs (18.7 KB)
Edit: since variable grid height doesn’t seem to work on Mac:
icon_viewer3_mac_edition.cs (18.8 KB)

(To test: Open the attached cs file in ScriptEditor and run)

5 Likes

Thanks @Gijs this is really helpful to explore!

Are there any examples of “drag & drop” file importing?

I wanted to mockup a test form similar to this svg loader where it would have a blank “field” that you could drag and drop an image file into from finder/explorer and drop it into the the Eto.Form “field” which would then show a preview of said image and when the user clicks accept or okay it would “do something” with that bitmap, likely just have it loaded into memory for use elsewhere in a script or something.

I may try and mock that up and share here, the file I/O part seems straight forward enough to me but I’m hung up on how the drag/drop features work with eto.forms.controls.

Anyways, thanks for this example, I’m a visual learner and this is really helpful!

@Gijs we should get samples added to our github repo so they don’t get lost here in discourse. Others are welcome to add as well if they want to submit a pull request

4 Likes

Hello, thanks for the info about ChatGPT!

Personally, I learned C# mostly (almost entirely) thanks to ILSpy and the Rhino/Grasshopper libraries.

I find that nothing is more instructive than reading the source code of people more skilled than us, rather than going through lengthy, abstract tutorials.

Given the undeniable lack of documentation on Eto, I couldn’t have managed without this approach for that library.

But I’m very excited to test ChatGPT and see how it goes!

Hi Gijs,

Oh wow - there has been quite a bit of discussion going on.

I think what I would be most interested in is on how to build a “complex” cross Plattform Tree View with things like Icons, Drag&Drop Functionality and so on.

Just something like the Layer Manager of Rhino

  • Martin

P.S.: Adding Examples to the GitHub Repo, would be great

2 Likes

Just for the record, in Eto that is a GridView. The sample I posted shows a way already to create a GridView with text and images.

What would you want to drag/drop?

Interesting that you make previews for the even-sized (24, 26, 28…) only.
While in the Options dialog it is possible to set e.g. 33.
IMO it shouldn’t be possible to set those uneven sizes.

It’s just a sample :slight_smile: If you open the code, you can change the steps to whatever you prefer.

For some odd display scaling, I believe it is helpful

Ah ok, I didn’t think of that.

I know… I thought the even steps had a reason.

in case you’ve missed, @CallumSykes has written some excellent eto docs, which you can find here

and I just added another sample to in Rhino - Eto Examples
Let us know what else you would like to see in there.

1 Like

The WPF version of this existed for years but everything I read or watched about it said to steer clear of it.

Winforms seems to be one of the few systems that implemented this in a reliable way. Microsoft broke that too haha. I think they were trying to go cross platform but that’s around the time I gave up on C#.

Eto looks similar to Winforms so it’s possible maybe? But it would be a lot of work I’m guessing.

I think the XAML version of this was/is quite good honestly.

I think the complexity is creating a nice text based syntax you can use to define the Eto UI. It’s something I’d like though.

I recall with Winforms that the code generated from the drag/dropping… if you went into that code and edited just the smallest piece of it it was game over - it would be quicker to start from scratch! That is if you didn’t understand the code. It forced me to learn and then I bought a really awesome book on WinForms. That book is so good that learning Winforms helped me learn C# (I was struggling with lots of the resources I had at the time).

I gave up on WPF after a few issues. One was the XAML and certain things not functioning properly. I figured if I’m going to go through the trouble of XAML it ought to work correctly. It’s not intuitive (nor can it really be) and takes a lot of time to learn, for me at least. One issue was setting up styles of some sort… I can remember but it was broken. And the other was that they didn’t even have a folder browsing dialog (since fixed but still…) and just directed people to use WinForm’s version.

It wouldn’t be so bad if they just left well-enough alone but MS keeps changing and breaking stuff.

Being able to write ETO in the same language the coder is writing their script/plugin in is a huge plus I think. The script editor also enables rapid testing. I think there’s a lot of potential!!

I know it’s frowned upon but I’ve been having really good success generating AI code. It basically provides me with an “example” that I just need to adjust (there’s always a few things to fix but it helps me learn). I’m going to test ETO code soon to see what I can create, that might be a work-around for the lack of examples currently available.

Yes I recall this being quite tricky.

I’d absolutely agree, that’s why I opted for it.

I think AI is very good when its result can be quickly verified. Code is a great example for this because it won’t compile or work correctly you can figure out why. It’s actually quite a good way of learning, just like how Meccano used to include incorrect steps in the instructions to make kids problem solve.

1 Like

i second that. would love to have an insight in the layers table.

I’ve been trying to think of an in depth Eto Tutorial that would show how to make something complex from scratch for the Eto Docs, I think this would be an interesting idea.