We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ToolStripEx - Adding a new item made by button + edit

Thread ID:

Created:

Updated:

Platform:

Replies:

105103 Sep 7,2012 03:30 PM UTC Sep 14,2012 12:11 PM UTC WinForms 3
loading
Tags: Tools
Administrator [Syncfusion]
Asked On September 7, 2012 03:30 PM UTC

Hi, I actually use ToolStripEx with many ToolStripButton, but now I need to add a new command (collapse gri up to level) that needs an input by the user --> It would be great to let the user type the value directly in toolstrip instead of displaying a for with just an edit-box and ok button.

I tried to do this but I cannot use ToolStripButton + TextBox, I need to use ToolStripButton in order to keep my old code related to image alignment, Checked property,...

Here my class

Imports System.Windows.Forms
Imports System.Drawing
Imports Syncfusion.Windows.Forms
 
 
Public Class ButtonTextBoxToolStripItem
    Inherits ToolStripControlHost
 
    Public Sub New()
        MyBase.New(New ButtonTextBoxControlPanel)
 
    End Sub
 
    Public ReadOnly Property ControlPanelControl() As ButtonTextBoxControlPanel
        Get
            Return CType(Me.Control, ButtonTextBoxControlPanel)
        End Get
    End Property
 
    Public ReadOnly Property Button() As Button 'ToolStripButton
        Get
            Return Me.ControlPanelControl().btn
        End Get
    End Property
 
    Public Property Checked As Boolean
        Get
            'Return Me.ControlPanelControl.btn.Checked
            Return False
 
        End Get
        Set(value As Boolean)
            'Me.ControlPanelControl.btn.Checked = value;
        End Set
    End Property
 
End Class
 
 
Public Class ButtonTextBoxControlPanel
    Inherits Panel
 
 
    Friend WithEvents btn As New Button 'Button 'ToolStripButton
    Friend WithEvents txt As New TextBox
 
    Public Sub New()
 
        btn.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Bottom
        'lbl.Text = "Test"
        btn.TextAlign = ContentAlignment.MiddleLeft
        btn.AutoSize = True
        btn.Height = Me.Height
        'btn.Size = New Size(30, Me.Height)
        btn.Location = New Point(00)
        btn.Parent = Me
 
        txt.Anchor = AnchorStyles.Left Or AnchorStyles.Right Or AnchorStyles.Top
        txt.Height = Me.Height
        txt.Location = New Point(btn.Bounds.Right, btn.Bounds.Top)
        txt.Width = Me.Width - txt.Left
        txt.Parent = Me
 
    End Sub
 
End Class



Administrator [Syncfusion]
Replied On September 10, 2012 03:23 PM UTC

I succeeded in making something work...but at start-up panel is not sized properly: button is not displayed

Imports System.Windows.Forms
Imports System.Drawing
Imports Syncfusion.Windows.Forms
Imports Syncfusion.Windows.Forms.Tools
 
 
Public Class ButtonTextBoxToolStripItem
    Inherits ToolStripPanelItem
 
    'Friend WithEvents btn As New ToolStripButton
    'Friend WithEvents txt As New TextBox
 
    Public Sub New()
        Me.Items.Add(New ToolStripLabel("Prova"))
        Me.Items.Add(New ToolStripTextBox)
        Me.Items.Add(New ToolStripButton)
 
        Me.InitItems()
    End Sub
 
    Public ReadOnly Property Button() As ToolStripButton
        Get
            Return Me.Items.Item(2)
        End Get
    End Property
    Public ReadOnly Property TextBox() As ToolStripTextBox
        Get
            Return Me.Items.Item(1)
        End Get
    End Property
 
    Public ReadOnly Property Label() As ToolStripLabel
        Get
            Return Me.Items.Item(0)
        End Get
    End Property
 
    Public Sub InitItems()
 
        Me.Button.Anchor = AnchorStyles.Top Or AnchorStyles.Right
        Me.Button.Dock = DockStyle.Top And DockStyle.Left
        'Me.Button.AutoSize = False
 
        'Me.TextBox.AutoSize = False
 
        Me.Label.Anchor = AnchorStyles.Top Or AnchorStyles.Left
        Me.Label.Dock = DockStyle.Top And DockStyle.Right
        'Me.Label.AutoSize = False
 
        Me.RowCount = 1
 
        'Me.LayoutStyle = ToolStripLayoutStyle.HorizontalStackWithOverflow
 
        'Me.Label.Width = Me.Width - Me.Label.Bounds.Left()
    End Sub
End Class
 

Berkunath A [Syncfusion]
Replied On September 12, 2012 01:06 PM UTC

Hi Silvio ,
 
Thanks for your interest in Syncfusion products.
 
We are working on this forum. We will update you the more information in two business day [September 14, 2012].
 
Please let us know if you have any concerns.
 
Regards,
 
Berkunath A

Berkunath A [Syncfusion]
Replied On September 14, 2012 12:11 PM UTC

Hi Silvio ,

Thanks for your patience.

You can achieve the requirement using attached  sample. Please run the sample and let us know if it helps you.

[sample link]

http://www.syncfusion.com/downloads/Support/DirectTrac/97809/ButtonTextBoxToolStrip495257401.zip

Please let us know if you need any other details.

Regards,
Berkunath A


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;