Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use Menu? #25

Closed
ywxt opened this issue Jul 8, 2018 · 9 comments
Closed

How to use Menu? #25

ywxt opened this issue Jul 8, 2018 · 9 comments

Comments

@ywxt
Copy link

ywxt commented Jul 8, 2018

Hi,
I found Menu in LibUISharp.However I dot not find any demo to use Menu.
When I ran the following code, a window did not appear and the dotnet process exited at once.

 public class MainWindow : Window
    {
        private readonly Menu _menu=new Menu("Demo");
	
        public MainWindow() : base("LibUISharp Control Gallery", new Size(640, 480), true) => InitializeComponent();
	
        protected sealed override void InitializeComponent()
        {
            IsMargined = true;
            Child = _menu;
            _menu.AddAboutItem(arg=>ShowMessageBox("Demo","Demo"));
            _menu.AddSeparator();
            _menu.AddQuitItem();
        }
    }

I hope you can help me.
Thanks.

@simplexidev
Copy link
Owner

I haven't tested the menu much yet, but if you give a couple. Hours to get off work I'll look into it and update you.

@ywxt
Copy link
Author

ywxt commented Jul 8, 2018

Looking forward to your reply,

@simplexidev
Copy link
Owner

simplexidev commented Jul 8, 2018

I just got back to my computer. I'm looking into it now @ywxt, and thanks for the edit.

@simplexidev
Copy link
Owner

Could you also please let me know what OS your are using?

@ywxt
Copy link
Author

ywxt commented Jul 8, 2018

Windows10

@simplexidev
Copy link
Owner

simplexidev commented Jul 8, 2018

Alright. I'm linking and closing the new issue you made (#26), as this is the same issue. I didn't notice they were separate issues at first. I also see that I screwed up on interpreting the native API, so I'll have a fix later this evening (it's currently 4:21PM here).

@simplexidev
Copy link
Owner

I'm pushing a commit now that adds a new example project SimpleWindowWithMenu. This show how to properly setup the menu (which is mildly annoying now that I looked at the native API closer).

Notes for my future reference: There is an open issue and a closed issue that explain that the Menu API is going to ultimately change, and a closed one that explains how it is currently setup in the libui repository.

@simplexidev
Copy link
Owner

I should also mention I'll be making numerous changes, but current code should/may run fine.

Either way, the demo projects will be updated accordingly before I merge the changes.

@ywxt
Copy link
Author

ywxt commented Jul 9, 2018

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants