My Community
July 22, 2014, 10:45:31 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: ViGlance Summer Edition 2!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: VB.NET/C# change tab text to equal form text  (Read 5330 times)
Aaron7pm
Hero Member
*****
Posts: 895


Universal Poster


View Profile WWW Email
« on: May 05, 2010, 06:26:32 PM »

I have a MDI tab control for my program Scriber and im trying to make it to where when I open a file, it changes the Tabs text to the forms text (ex: Scriber Sampledoc.html), which needs to be the Documents name (ex: Sampledoc.html)

So Tab Text = Form name = document name

but Form name must = document name before changing the Tab text

Kind of like loading a doc in Writer and such, The tabs text is the documents name. But in this case the tabs text is the forms name which is the documents name..... I know it's complicated.... Tongue Tongue Tongue Tongue Roll Eyes Roll Eyes Roll Eyes Roll Eyes Roll Eyes
Logged

Mixen Dixon
Hero Member
*****
Posts: 555


Reformed, radical, right-wing Christian nerd


View Profile WWW Email
« Reply #1 on: May 06, 2010, 04:57:05 AM »

Code:
Public Shadows Property Text As String
    Get
        Return MyBase.Text
    End Get
    Set(ByVal value As String)
        MyBase.Text = value
        TabPage1.Text = value
    End Set
End Property
Logged

The grace and peace of God the Father and the Lord Jesus Christ be with your spirit.
:::: I am Mixen Dixon, and I approve this message.
:::: My blog: http://christian-contemplate.blogspot.com/
Aaron7pm
Hero Member
*****
Posts: 895


Universal Poster


View Profile WWW Email
« Reply #2 on: May 06, 2010, 06:39:35 AM »

Thanks I'll try it, but I'm not using MS tab control, I'm using a Custom MDI tab control.

I can send you the dll file if you want,
Logged

Mixen Dixon
Hero Member
*****
Posts: 555


Reformed, radical, right-wing Christian nerd


View Profile WWW Email
« Reply #3 on: May 06, 2010, 07:38:33 AM »

Well, regardless of what type of control your using, you just need to specify it instead of "TabPage1" as long as it has the Text property. If not, set the appropriate property of the title.
Logged

The grace and peace of God the Father and the Lord Jesus Christ be with your spirit.
:::: I am Mixen Dixon, and I approve this message.
:::: My blog: http://christian-contemplate.blogspot.com/
Aaron7pm
Hero Member
*****
Posts: 895


Universal Poster


View Profile WWW Email
« Reply #4 on: May 06, 2010, 06:24:43 PM »

Doesnt work... you see this MDI tab control doesnt have a tab page collection...
Logged

Mixen Dixon
Hero Member
*****
Posts: 555


Reformed, radical, right-wing Christian nerd


View Profile WWW Email
« Reply #5 on: May 07, 2010, 04:44:11 AM »

It's not about the tab page collection. What property sets a MDI tab's text? For example, if you have MdiTab1, set its Text or Title or whatever property. If you only have a collection of MDI tabs, choose the selected one and set it. (BTW: Did I mention the code is code for the form, not the tab?)
Logged

The grace and peace of God the Father and the Lord Jesus Christ be with your spirit.
:::: I am Mixen Dixon, and I approve this message.
:::: My blog: http://christian-contemplate.blogspot.com/
Aaron7pm
Hero Member
*****
Posts: 895


Universal Poster


View Profile WWW Email
« Reply #6 on: May 07, 2010, 08:30:05 AM »

There are no tabs, the tabs are generated at load and button click, the control does not allow tabs to be made in the designer.
Logged

Mixen Dixon
Hero Member
*****
Posts: 555


Reformed, radical, right-wing Christian nerd


View Profile WWW Email
« Reply #7 on: May 07, 2010, 08:53:39 AM »

Is the list of runtime-generated tabs available? If not, try adding a means for listing and identifying them so they can be manipulated. For example (just replace MdiTab with the class name):
Code:
Public Class MdiTabCollection
    Private mdiTabs As List(Of MdiTab)
    Private selIndex As Integer

    Public Sub New()
        tabs = New List(Of MdiTab)
        selIndex = 0
    End Sub

    Public ReadOnly Property Tabs As ObjectModel.ReadOnlyCollection(Of MdiTab)
        Get
            Return New ObjectModel.ReadOnlyCollection(Of MdiTab)(mdiTabs)
        End Get
    End Property

    Public Sub AddTab(ByVal tab As MdiTab)
        mdiTabs.Add(tab)
        'Code for adding tab to form. If necessary, add arguments to this method.
        AddHandler tab.Focus, AddressOf TabFocused
        selIndex = mdiTabs.Count - 1
    End Sub

    Public Property SelectedTab As MdiTab
        Get
            Return mdiTabs(selIndex)
        End Get
        Set(ByVal value As MdiTab)
            value.Focus()
            selIndex = mdiTabs.IndexOf(value)
        End Set
    End Property

    Private Sub TabFocused(ByVal sender As System.Object, ByVal e As System.EventArgs)
        SelectedTab = sender
    End Sub
End Class
With this, just set the text of the SelectedTab property.
Logged

The grace and peace of God the Father and the Lord Jesus Christ be with your spirit.
:::: I am Mixen Dixon, and I approve this message.
:::: My blog: http://christian-contemplate.blogspot.com/
Aaron7pm
Hero Member
*****
Posts: 895


Universal Poster


View Profile WWW Email
« Reply #8 on: May 09, 2010, 01:31:04 PM »

no that wont work either... you just arent getting it, the control is unique different from the one in windows.

http://www.codeproject.com/KB/cpp/MDITabControl.aspx
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!