LAVA: Programmatically create new page in tab control? - LAVA

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Programmatically create new page in tab control? Rate Topic: -----

#1 User is offline   Noxious 

  • Active
  • Pip
  • Group: Members
  • Posts: 14
  • Joined: 03-May 07

Posted 25 January 2010 - 07:49 PM

Greetings,

I am trying to create a UI that can be used across many applications and am (thus far) unable to programmatically create/delete a new page on a tab control. Does anyone have any ideas on how to do this?

Thanks in advance.


0

#2 User is online   François Normandin 

  • The 500 club
  • Group: Moderators
  • Posts: 836
  • Joined: 18-January 08
  • Location:Montréal, QC
  • Version:LabVIEW 2009
  • Since:1999

Posted 25 January 2010 - 08:02 PM

View PostNoxious, on 25 January 2010 - 02:49 PM, said:

Greetings,

I am trying to create a UI that can be used across many applications and am (thus far) unable to programmatically create/delete a new page on a tab control. Does anyone have any ideas on how to do this?

Thanks in advance.




You cannot create tabs dynamically (at Runtime) because it needs recompiling the code. You can only do it at development time. If in Dev environment, then there is a method for Adding/Removing tabs.
Search the forums to find the solutions proposed to get around this problem, it's been asked many times and based on your application, an alternative solution might already be out there waiting...Creating all your tabs beforehand and hiding some based on your different UIs is one of them.
François [frɑ̃swa]
0

#3 User is offline   JustinThomas 

  • Very Active
  • PipPipPip
  • Group: Members
  • Posts: 71
  • Joined: 08-March 06
  • Version:LabVIEW 8.6
  • Since:2004

Posted 27 January 2010 - 05:39 AM

It is not possible to create pages on the fly during runtime for a Tab Control. I generally do this kind of thing using a 'subpanel'. If you could post what you are trying to achieve people on the forum can give alternate suggestions

This post has been edited by JustinThomas: 27 January 2010 - 05:40 AM

0

#4 User is offline   ScubaBob 

  • One hit wonder!
  • Group: Members
  • Posts: 1
  • Joined: 23-February 10
  • Version:LabVIEW 2009
  • Since:2009

Posted 23 February 2010 - 03:20 AM

Here is what i have come up with for creating tabcontrol and pages at runtime in vb2005

Dim i As Integer

Dim temp As TabControl() = New TabControl(1) {}

Dim SComp2 As String() = Nothing

Dim CNT As Integer = 0

temp(CNT) = New TabControl

temp(CNT).Name = sString(3)

temp(CNT).Location = New System.Drawing.Point(Val(sString(5)), Val(sString(6)))

temp(CNT).Size = New System.Drawing.Size(Val(sString(7)), Val(sString(8)))

temp(CNT).Tag = Val(sString(2))

'temp(CNT).TextAlign = ContentAlignment.MiddleCenter

'temp(CNT).ForeColor = System.Drawing.Color.Black

'temp(CNT).BackColor = System.Drawing.Color.LightSalmon

SComp2 = sString(4).Split(";")

For i = 0 To SComp2.GetUpperBound(0)

temp(CNT).TabPages.Add(SComp2(i))

Next i

For Each ctrl As Control In SplitContainer1.Panel1.Controls

If TypeOf ctrl Is GroupBox Then

If CType(ctrl, GroupBox).Tag = Val(sString(1)) Then

CType(ctrl, GroupBox).Controls.Add(temp(CNT))

End If

End If

Next


This post has been edited by ScubaBob: 23 February 2010 - 03:44 AM

0

#5 User is offline   Mark Yedinak 

  • Extremely Active
  • Group: Premium Member
  • Posts: 368
  • Joined: 08-May 06
  • Location:Chicago, IL
  • Version:LabVIEW 8.6
  • Since:1997

Posted 23 February 2010 - 06:18 PM

View PostScubaBob, on 22 February 2010 - 09:20 PM, said:

Here is what i have come up with for creating tabcontrol and pages at runtime in vb2005

Dim i As Integer

Dim temp As TabControl() = New TabControl(1) {}

Dim SComp2 As String() = Nothing

Dim CNT As Integer = 0

temp(CNT) = New TabControl

temp(CNT).Name = sString(3)

temp(CNT).Location = New System.Drawing.Point(Val(sString(5)), Val(sString(6)))

temp(CNT).Size = New System.Drawing.Size(Val(sString(7)), Val(sString(8)))

temp(CNT).Tag = Val(sString(2))

'temp(CNT).TextAlign = ContentAlignment.MiddleCenter

'temp(CNT).ForeColor = System.Drawing.Color.Black

'temp(CNT).BackColor = System.Drawing.Color.LightSalmon

SComp2 = sString(4).Split(";")

For i = 0 To SComp2.GetUpperBound(0)

temp(CNT).TabPages.Add(SComp2(i))

Next i

For Each ctrl As Control In SplitContainer1.Panel1.Controls

If TypeOf ctrl Is GroupBox Then

If CType(ctrl, GroupBox).Tag = Val(sString(1)) Then

CType(ctrl, GroupBox).Controls.Add(temp(CNT))

End If

End If

Next




And this helps someone with LabVIEW in what way?
---
Mark Yedinak - Certified LabVIEW Architect

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic