question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Programmatically add tab into Border

See original GitHub issue

Hi, here is my border definition on program startup, It has 2 tabs in right border definition.

`borders:[ { “type”: “border”, “location”:“right”, “size”:500, “selected” : 0, “children”: [ { “type”: “tab”, “selected” : 0, “enableClose”:false, “name”: “KATMANLAR”, “component”: “deneme”, },
{ “type”: “tab”, “enableClose”:true, “name”: “KATMANLAR2”, “component”: “deneme”, },

        ]
    },
	{
      "type": "border",
      "location":"left",
	  "size":300,
	  "selected" : 0,
      "children": [
          {
          "type": "tab",
  		  "selected" : 0,
		  "enableClose":false,
          "name": "ÇİZİM",
          "component": "cizimAraclari",
          },

        ]
    }
],`

I want to add new tab with button click into right border after KATMANLAR2 tab. I can add a new tab into tabset, but i can’t find a solution for border

Thanks inadvance

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
N8th8n8elcommented, Mar 10, 2020

Found a workaround in case this is intended behaviour:

model.doAction(
  Actions.addNode(
    {
      type: "tab",
      enableClose: true,
      name: "MyName",
      component: "MyComponent"
    },
    model
      .getBorderSet()
      .getBorders()
      .find(b => b.getLocation() === DockLocation.BOTTOM)
      .getId(),
    DockLocation.BOTTOM,
    -1
  )
);

// If a tab in the same border is visible,
// selectTab causes the new tab to hide
const shouldSelectNewTab = !model
  .getBorderSet()
  .getBorders()
  .find(b => b.getLocation() === DockLocation.BOTTOM)!
  .getChildren()
  .map(c => c.isVisible())
  .includes(true);

if (shouldSelectNewTab) {
  model.doAction(
    Actions.selectTab(
      model
        .getBorderSet()
        .getBorders()
        .find(b => b.getLocation() === DockLocation.BOTTOM)!
        .getChildren()
        .slice(-1)[0] // Get last children === new tab
        .getId();
    )
  );
}
0reactions
spider58commented, Mar 11, 2020

@N8th8n8el thank you 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

add border around tabs in android - Stack Overflow
I am adding the tabs programmatically in activity class as i have to decide the no of tabs on run-time. Implement custom tab....
Read more >
Tab Page Borders..can I make one? in UI for WinForms - Telerik
Hi, I have a Tab Control with several Tab Pages, and I would like to create/modify borders for the actual tab portion... Is...
Read more >
NET MAUI Shell tabs - Microsoft Learn
Learn how to customize and control a .NET MAUI TabBar, which represents the bottom tab bar in a .NET MAUI Shell app.
Read more >
Navs and tabs · Bootstrap v5.0
Documentation and examples for how to use Bootstrap's included navigation components. On this page. Base nav; Available styles. Horizontal alignment; Vertical ...
Read more >
How to Build a Tabs Component with React - DigitalOcean
In this step, you will create a new folder and the Tabs component that will render each Tab . First, create a folder...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found