Closed LeviBickel closed 3 years ago
On the second code, you are not adding it to the tabs list, you are only just creating a new tab.
To add new tabs, you must create and add them to the list.
Try adding app.Tabs.Add(newtab);
after var newtab = new TitleBarTab(app) { Content = new BrowserMain(parameters.LinkUrl) { Text = "New Tab" } };
.
@ivanthesexy Thank you for the response. I have tried that and it still isn't working. Please take a look at my repository for the full code specifically this is on the ContextMenuHandler Line 105 : https://github.com/LeviBickel/Chromium-Browser/tree/Fixing-Open-In-New-Tab
AppContainer app = new AppContainer(); var newtab = new TitleBarTab(app) { Content = new BrowserMain(parameters.LinkUrl) { Text = "New Tab" } }; app.Tabs.Add(newtab); app.SelectedTabIndex = app.SelectedTabIndex + 1; app.RedrawTabs(); app.Refresh();
@ivanthesexy Thank you for the response. I have tried that and it still isn't working. Please take a look at my repository for the full code specifically this is on the ContextMenuHandler Line 105 : https://github.com/LeviBickel/Chromium-Browser/tree/Fixing-Open-In-New-Tab
AppContainer app = new AppContainer(); var newtab = new TitleBarTab(app) { Content = new BrowserMain(parameters.LinkUrl) { Text = "New Tab" } }; app.Tabs.Add(newtab); app.SelectedTabIndex = app.SelectedTabIndex + 1; app.RedrawTabs(); app.Refresh();
Just noticed that you did also created a new container and added your tab to it. Of course it won't work because we didn't added it to our real list. Sorry about that. You need to change app
container and use your original TitleBarTabs form instead.
You don't need to create another container if you want to add new tabs to an already created container at the beginning. I created a pull request in your project. Please check it.
@ivanthesexy I really appreciate the pull request! I have confirmed the tab is opening but, the URL isn't getting passed over for some reason. I will start investigating this. I really appreciate the help!!
@LeviBickel
How did you add easytabs programmatily
How did you add easytabs programmatily
What do you mean by "add easytabs programmatily"? Details on installing EasyTabs are located right below in README of this repository or install the NuGet package from NuGet Package Manager. If you meant to create tabs programmatically, just use CreateTab()
in your TitleBarTabs form (the main form, the one that contains the tabs).
@jarno9981 Feel free to fork my Browser repo. https://github.com/LeviBickel/Chromium-Browser
@LeviBickel thank you
I am trying to programmatically add a new tab with a contextmenustrip. I have the menu working and I can create a new window successfully using the following: ` AppContainer app = new AppContainer(); var newtab = new TitleBarTab(app) { Content = new BrowserMain(parameters.LinkUrl) { Text = "New Tab" } }; app.Tabs.Add(newtab); app.SelectedTabIndex = app.SelectedTabIndex + 1;
` It appears this is just creating an entirely new form. I am looking to have this add a tab to the current form though. I have tried the following
` AppContainer app = new AppContainer(); var newtab = new TitleBarTab(app) { Content = new BrowserMain(parameters.LinkUrl) { Text = "New Tab" } }; app.SelectedTabIndex = app.SelectedTabIndex + 1; app.RedrawTabs(); app.Refresh();
` I can't find anything in the documentation or on Google to figure this out. There are no errors in the debugger and when I step through the code it is running through all the steps to create the form but, never shows the tab on the UI to actually navigate to it.