See Also

Enumerations

Name Values
This class exposes no enumerations.

Constants

Name Type Value
This class exposes no constants.

Events

Definition Description
Action( ButtonName as String, ButtonCaption as String ) Raised when a user clicks on a toolbar button.
HelpTagText( theHelpTag as String ) Raised when the HelpTag is to be displayed, allowing the opportunity to use non-standard HelpTag implementations
MouseOver( ButtonName as String ) Raised when the user hovers their mouse over a toolbar button.
Resized( theLeft as Integer, theRight as Integer, theWidth as Integer, theHeight as Integer.

Methods

Definition Description
ButtonEnabled( ButtonName as String) as Boolean Returns the current enabled state of a toolbar button.
ButtonSelected( ButtonName as String) as Boolean Returns the current selection state of a toggleable toolbar button.
CreateButton( theName As String, theCaption As String, theHelpTag As String, theIcon As Picture, theIconMask As Picture, theIcon16 As Picture, theIconMask16 As Picture, theVisible As Boolean, theEnabled As Boolean, theMenu As MenuItem ) Creates a new button and adds it to the display.
CreateControl( theName As String, theCaption As String, theHelpTag As String, theVisible As Boolean, theControl As RectControl, Stretch As Boolean ) Creates a new RectControl-based button area and adds it to the display.
CreateSpacer( theVisible as Boolean ) Creates a toolbar item spacer and adds it to the display.
EnableAll( State as Boolean ) Assigns the value of the state parameter to all current toolbar items.
EnableButton( ButtonName as String, theState as Boolean ) Applies the value of theState to the enabled property of the button specified by ButtonName
GetButton( ButtonName as String ) as KTBList Returns a KTBList object representing the requested button.
GetToolbarStyle() as Integer Returns the currently assigned toolbat style.
SelectButton( ButtonName as String, theState as Boolean ) Applied theState to a toolbar items selection property.
SetButtonStyle( KTB as KTBStyle ) Applies the specified style to all toolbar items.
Setup( theName As String, x As Integer, y As Integer, theWidth As Integer, theHeight As Integer, IsVertical As Boolean, theButtonStyle As KTBStyle, theToolbarStyle As Integer, IsPref As Boolean, theIconSize As Integer ) Intializes a KillerToolbar instance.
Update() Forces the display to update. This should rarely ever be needed.
UpdateIcon( ButtonName as String, theIcon As Picture, theIconMask As Picture, theIcon16 As Picture, theIconMask16 As Picture ) Updates the displayed icon for the specified button.
UpdateIcon( theButton as KTBList, theIcon As Picture, theIconMask As Picture, theIcon16 As Picture, theIconMask16 As Picture )
UseCaption() as Boolean Returns True if the toolbar is configured to display captions on toolbar items.
UseIcon() as Boolean Returns True if the toolbar is configured to display icons on toolbar items.
Vertical() as Boolean Returns True if the toolbar is displayed vertically.

Properties

Name Type Default Value Description
ButtonsAvail() KTBList Nil Available buttons for display.
ButtonStyle KTBStyle Nil Style applied to the display.
ButtonsUsed() KTBButton Nil Buttons currently displayed on the toolbar.
DefaultStyle Integer 0 The default style assignment for the toolbar.
NoCustomize Boolean False If True, users will be unable to customize which items displayed in the toolbar, or their order.
SmallIcon Boolean False If True, the icon used for the display of toolbar items with the smaller provided.

How to setup KillerToolBar in THREE easy steps

After adding a KillerToolBar Control to your window by dragging a canvas there and changing its Super to “KillerToolBar”, do the following…
(The following assumes that you’ve named your toolbar “KillerToolBar1″)

First you will need to initialize the toolbar by calling the “Setup” procedure. The parameters for the Setup procedure are outlined below:

dim strName as string = "MyKillerToolbar" '// The name which will be displayed in the "Customize" window title.
dim intX as Integer = 0 '// The X position of the toolbar on the window.
dim intY as Integer = 0 '// The Y position of the toolbar on the window.
dim intWidth as Integer = self.Width '// The width of the toolbar in pixels.
dim intHeight as Integer = 100 '// The height of the toolbar in pixels.
dim blnVert as Boolean = False '// Whether the toolbar will be vertical or horizontal (True = Vertical).
dim ktbButtonStyle as KTBStyle = new KTBStyleFudge '// The appearance of the buttons as defined by a class derived from the KTBStyle interface.
dim ktbToolbarStyle as Integer = 0 '// Determines the display type for the buttons, such as "Big Icons with labels", etc.
dim blnPref as Boolean = False '// True means this a preferences toolbar, and will not be customizable.  All buttons will be grouped together.
dim intIconSize as Integer = 32 '// The size of the icon.  KTB will automatically scale provided images to match this value.
 
KillerToolBar1.Setup(strName,intX,intY,intWidth,intHeight,blnVert,ktbButtonStyle,intToolbarStyle,blnPref,intIconSize)

Create as many buttons, controls or spacers as you like for your KillerToolBar:

dim strName as String = "SomeName" '// A name for the button. Used to see which button was pressed, so make this unique!
dim strCaption As String = "Save" '// The text that appears below / alongside the button
dim strHelpTag As String = "Save the current document" '// The help tag text
dim pIcon As Picture = SaveIcon '// The picture to use as the button image
dim pIconMask As Picture = SaveIconMask '// The mask for the above, or if the above contains a composite mask just use the same picture here
dim pIcon16 As Picture = SaveIcon16 '// A 16x16px image for the button, or if you don’t have one just use the same as theIcon and KillerToolBar will make one from that
dim blnVisible As Boolean = True '// Should this button be visible by default? If not, it will appear in the “Available Buttons” list in the “Customize” window…
dim blnEnabled As Boolean = True '// Should this button be enabled by default?
dim mnuMenu As MenuItem '// Drop down menu for the button. If none, use nil
dim ctlControl As RectControl = TextField1 '// A RectControl for the button – e.g. an EditField
dim blnStretch As Boolean = False '// In a horizontal toolbar, if set to true will Stretch the above control to available space. Note: Only one control can be stretched.
 
KillerToolBar1.CreateButton(strName,strCaption,strHelpTag,pIcon,pIconMask,pIcon16,pIconMask16,blnVisible,blnEnabled,mnuMenu)
KillerToolBar1.CreateControl(strName,strCaption,strHelpTag,blnVisible,ctlControl,blnStretch)
KillerToolBar1.CreateSpacer(blnVisible)

Call the “Update” procedure to finish setting up your KillerToolBar:

KillerToolBar1.Update

And that’s IT!!

Additionally, to make things pretty, you may add the following line to your Window’s DEACTIVATE Event:

KillerToolBar1.LostFocus(true)

And this one in your Window’s ACTIVATE Event:

KillerToolBar1.LostFocus(false)
  • Last modified: 6 weeks ago
  • by agcyphers