Freigeben über


ToolBar Object Properties, Methods and Events

Properties

ActiveControl Application BackColor
BaseClass Caption Class
ClassLibrary Comment ColorSource Property
ControlBox ControlCount Controls
DataSession DataSessionID Docked
DockPosition Enabled ForeColor
Height HelpContextID KeyPreview
Left LockScreen MouseIcon
MousePointer Movable Name
Objects OLEDragMode OLEDragPicture
OLEDropEffects OLEDropHasData OLEDropMode
Parent ParentClass ScaleMode
ShowTips ShowWindow Sizable
Tag Top Visible
WhatsThisHelpID Width  

Events

Activate AfterDock BeforeDock
Click DblClick Deactivate
Destroy DragDrop DragOver
Error Init MiddleClick Event
MouseDown MouseMove MouseUp
MouseWheel Moved OLECompleteDrag
OLEDragDrop OLEDragOver OLEGiveFeedBack
OLESetData OLEStartDrag Paint
Resize RightClick UnDock

Methods

AddObject AddProperty CloneObject
Dock Hide Move
NewObject OLEDrag ReadExpression
ReadMethod Refresh Release
RemoveObject ResetToDefault SaveAsClass
SetAll Show ShowWhatsThis
WriteExpression Method ZOrder  

Example

The following example demonstrates how you can create a toolbar from the Toolbar class. Visual FoxPro rearranges the buttons when the toolbar is resized. When the ToolBar object is created, Visual FoxPro automatically places the controls from left to right in the order they are added to the class definition, ignoring the controls' Top and Left properties.

PUBLIC tbrDesktop
tbrDesktop = CREATEOBJ('mytoolbar')
tbrDesktop.SHOW

DEFINE CLASS myToolBar  AS Toolbar
   ADD OBJECT btnBold  AS CommandButton
   ADD OBJECT sep1      AS Separator
   ADD OBJECT btnItalics AS CommandButton
   
   btnBold.HEIGHT = 20
   btnBold.WIDTH = 50
   btnBold.Caption = "Bold"
   btnItalics.HEIGHT = 20
   btnItalics.WIDTH = 50
   btnItalics.Caption = "Italic"
   btnItalics.FontBold = .F.
   
   LEFT   = 1
   TOP = 1
   WIDTH = 25

   CAPTION = "Desktop Attributes"
   
   PROCEDURE Activate 
   this.btnBold.FontBold = _SCREEN.FONTBOLD
   this.btnItalics.FontItalic = _SCREEN.FONTITALIC
   ENDPROC
   
   PROCEDURE btnBold.CLICK
   _SCREEN.FONTBOLD = !_SCREEN.FONTBOLD
   This.FontBold =_SCREEN.FONTBOLD
   ENDPROC
   
   PROCEDURE btnItalics.CLICK
   _SCREEN.FONTITALIC = !_SCREEN.FONTITALIC
   This.FontItalic = _SCREEN.FONTITALIC
   ENDPROC
ENDDEFINE

See Also

ToolBar Object | CREATE CLASS | CREATE FORM | DEFINE CLASS | Separator Object | Objects Collection