Welcome to the Xceed Community | Help
Community Search  
More Search Options

ToolBar Button Alignment

Sort Posts: Previous Next
  •  11-18-2003, 2:06 PM Post no. 3416

    ToolBar Button Alignment

    Is there a way to display a toolbar button right aligned on the toolbar? We have a normal group of buttons on the left side but would like our exit button displayed by itself on the far right.

    Thanks...
  •  11-22-2003, 9:54 AM Post no. 3417 in reply to 3416

    Re: ToolBar Button Alignment

    Hi Wayde,

    What you might want to try is to add the buttons you want on the left, add a SpringPanel SmartItem and then another button which should then be on the far right.

    I hope this helps!
    Senior Technical Writer
    - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
  •  11-24-2003, 5:58 PM Post no. 3418 in reply to 3417

    Re: ToolBar Button Alignment

    That's a great idea. I guess I didn't realize I could mix and match items like that.

    Thanks!
  •  02-29-2004, 4:55 PM Post no. 3419 in reply to 3417

    Re: ToolBar Button Alignment

    Hey I tryed that too.
    The spiringtool doesn't seem to work right when placed in a toolbar. it just won't expand.
  •  04-20-2004, 6:36 PM Post no. 3420 in reply to 3419

    Re: ToolBar Button Alignment

    I having the same problem. Is this a know bug with springpanel?
  •  07-27-2005, 1:40 PM Post no. 3421 in reply to 3420

    Re: ToolBar Button Alignment

    Same issue here.
    Is there any known way to get this working or not?
  •  08-01-2005, 1:30 PM Post no. 3422 in reply to 3416

    Re: ToolBar Button Alignment

    Putting a SpringPanel in the toolbar will not spring the button after it to the far right. You may want to send this to technical support so this issue can be fixed in a later release.

    I did however find a temporary fix you can use, though you may need to tinker with it a bit to fit it to your liking.

    In order to make this work, you will need to add a blank (no text & zero width) LabelTool on the toolbar in front of the button you want to push to the far right. The Tool button also needs to be assigned a default width big enough to hold its text string. In my case, I assigned a TextWidth of 50 to the button. Then in your Form SizeChanged event, put some code like the following:

    Private Sub frmMain_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.SizeChanged
    Dim width As Integer
    width = Me.Width - RightToolButton.TextWidth - tbStore.Bounds.Right - 20
    If width > 0 Then
    LabelTool2.Show()
    LabelTool2.Width = width
    Else
    LabelTool2.Hide()
    End If
    End Sub


    Basically, what the code I just posted does is this:

    1) Create a temporary variable to hold the width for the LabelTool.
    2) Get your form's width, then subtract the width of the RightToolButton from it. Then get the right position of the SmartItem that is before the LabelTool on the toolbar and subtract that. In my case, I had a button called ‘tbStore’ in front of the label. Lastly, you need to subtract around 20 or so more pixels from the width to fit the RightToolButton on the same line. This value may be able to be shortened, based on what SmartItem you are trying to put on the far right.
    3) Finally, you make sure the width value is greater than 0 before you assign it to the LabelTool. If it is greater than 0, then you are making the LabelTool visible and assigning it a new width. If it is not greater than 0, then you are hiding the LabelTool, as you won't need it to push the button.


    If you can think of a better solution let me know, as this is all I could think of. ;)
  •  01-11-2011, 12:24 PM Post no. 29577 in reply to 3422

    Re: ToolBar Button Alignment

    Was this issue ever resolved?  I am having the same issue now.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.