home *** CD-ROM | disk | FTP | other *** search
- //--------------------------------------------------------------
- //
- // MugBars.prg - Mugs Sample Application
- //
- // Definitions for the application and form toolbars.
- //
- // Dependencies: MUGS.DLL
- // MUGS.PRG
- //
- // Visual dBASE Samples Group
- //
- // $Revision: 1.3 $
- //
- // Copyright (c) 1997, Borland International, Inc.
- // All rights reserved.
- //
- //---------------------------------------------------------------
-
- class Mugbar( app ) of Toolbar
- // custom properties
- this.app = app
-
- // native properties
- this.flat := app.toolbars.flat
- endclass
-
- class MugAppBar( app ) of Mugbar( app )
- this.text := "Application"
- this.tOpen = new ToolButton( this )
- this.tOpen.onClick := { ; this.parent.app.openFileOpenDialog( this.parent.app ) }
- class::reset()
-
- function reset
- if ( this.app.toolbars.large )
- this.tOpen.bitmap := "RESOURCE TL_OPEN MUGSR.DLL"
- else
- this.tOpen.bitmap := "RESOURCE TS_OPEN MUGSR.DLL"
- endif
-
- if ( this.app.toolbars.hints )
- this.tOpen.speedTip := "Open..."
- else
- this.tOpen.speedTip := null
- endif
- this.flat := this.app.toolbars.flat
- return true
-
- endclass
-
- class MugDatabar( app ) of Mugbar( app )
- this.onUpdate := class::Databar_onUpdate
- this.text := "Databar"
-
- // define toolbuttons
-
- this.tPrint = new ToolButton( this )
- this.tPrint.onClick := { ; this.parent.form.print() }
-
- this.tAppend = new ToolButton( this )
- this.tAppend.onClick := ;
- { ; this.parent.form.app.dataAction.appendRow( ;
- this.parent.form ) }
-
- this.tDelete = new ToolButton( this )
- this.tDelete.onClick := ;
- { ; this.parent.form.app.dataAction.deleteRow( ;
- this.parent.form ) }
-
- this.tSave = new ToolButton( this )
- this.tSave.onClick := ;
- { ; this.parent.form.app.dataAction.saveRow( ;
- this.parent.form ) }
-
- this.tAbandon = new ToolButton( this )
- this.tAbandon.onClick := ;
- { ; this.parent.form.app.dataAction.abandonRow( ;
- this.parent.form ) }
-
- this.tSep1 = new ToolButton( this )
- this.tSep1.separator := true
-
- this.tLocate = new ToolButton( this )
- this.tLocate.onClick := ;
- { ; this.parent.form.app.dataAction.locateRow( ;
- this.parent.form ) }
-
- this.tSep2 = new ToolButton( this )
- this.tSep2.separator := true
-
- this.tFirst = new ToolButton( this )
- this.tFirst.onClick = ;
- { ; this.parent.form.app.dataAction.goFirst( ;
- this.parent.form ) }
-
- this.tPrev = new ToolButton( this )
- this.tPrev.onClick := ;
- { ; this.parent.form.app.dataAction.goPrev( ;
- this.parent.form ) }
-
- this.tNext = new ToolButton( this )
- this.tNext.onClick := ;
- { ; this.parent.form.app.dataAction.goNext( ;
- this.parent.form ) }
-
- this.tLast = new ToolButton( this )
- this.tLast.onClick := ;
- { ; this.parent.form.app.dataAction.goLast( ;
- this.parent.form ) }
-
- this.tHelp = new ToolButton( this )
- this.tHelp.onClick := { ; HELP }
-
- class::reset()
-
- function reset
- if ( this.app.toolbars.large )
- with ( this )
- tPrint.bitmap := "RESOURCE TL_PRINT MUGSR.DLL"
- tAppend.bitmap := "RESOURCE TL_APPEND"
- tDelete.bitmap := "RESOURCE TL_DELETE"
- tSave.bitmap := "RESOURCE TL_SAVE"
- tAbandon.bitmap := "RESOURCE TL_ABANDON"
- tLocate.bitmap := "RESOURCE TL_LOCATE"
- tFirst.bitmap := "RESOURCE TL_FIRST"
- tPrev.bitmap := "RESOURCE TL_PREV"
- tNext.bitmap := "RESOURCE TL_NEXT"
- tLast.bitmap := "RESOURCE TL_LAST"
- tHelp.bitmap := "RESOURCE TL_HELP MUGSR.DLL"
- endwith
- else
- with ( this )
- tPrint.bitmap := "RESOURCE TS_PRINT MUGSR.DLL"
- tAppend.bitmap := "RESOURCE TS_APPEND"
- tDelete.bitmap := "RESOURCE TS_DELETE"
- tSave.bitmap := "RESOURCE TS_SAVE"
- tAbandon.bitmap := "RESOURCE TS_ABANDON"
- tLocate.bitmap := "RESOURCE TS_LOCATE"
- tFirst.bitmap := "RESOURCE TS_FIRST"
- tPrev.bitmap := "RESOURCE TS_PREV"
- tNext.bitmap := "RESOURCE TS_NEXT"
- tLast.bitmap := "RESOURCE TS_LAST"
- tHelp.bitmap := "RESOURCE TS_HELP MUGSR.DLL"
- endwith
- endif
-
- if ( this.app.toolbars.hints )
- with ( this )
- tPrint.speedTip := "Print..."
- tAppend.speedTip := "Append Row"
- tDelete.speedTip := "Delete Row..."
- tSave.speedTip := "Save Row"
- tAbandon.speedTip := "Abandon Row"
- tLocate.speedTip := "Locate Row..."
- tFirst.speedTip := "First Row"
- tPrev.speedTip := "Previous Row"
- tNext.speedTip := "Previous Row"
- tLast.speedTip := "Last Row"
- tHelp.speedTip := "Help"
- endwith
- else
- with ( this )
- tPrint.speedTip := null
- tAppend.speedTip := null
- tDelete.speedTip := null
- tSave.speedTip := null
- tAbandon.speedTip := null
- tLocate.speedTip := null
- tFirst.speedTip := null
- tPrev.speedTip := null
- tNext.speedTip := null
- tLast.speedTip := null
- tHelp.speedTip := null
- endwith
- endif
- this.flat := this.app.toolbars.flat
-
- return true
-
- function Databar_onUpdate
- LOCAL bRowActive, bAtFirst, bAtLast
- bActiveRow = false
- bAtFirst = true
- bAtLast = true
-
- if ( TYPE("this.form.rowset.parent.active") == "L" )
- bActiveRow := this.form.rowset.parent.active
- endif
-
- if ( bActiveRow )
- bAtFirst := this.form.rowset.atFirst()
- bAtLast := this.form.rowset.atLast()
- endif
-
- with ( this )
- tPrint.enabled := bActiveRow
- tAppend.enabled := bActiveRow
- tDelete.enabled := bActiveRow
- tSave.enabled := bActiveRow
- tAbandon.enabled := bActiveRow
- tLocate.enabled := bActiveRow
- tFirst.enabled := ( not bAtFirst )
- tPrev.enabled := ( not bAtFirst )
- tNext.enabled := ( not bAtLast )
- tLast.enabled := ( not bAtLast )
- endwith
-
- return ( bActiveRow )
-
- endclass
-