Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Toolbar, Timer and BindEvents
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00791267
Message ID:
00791356
Vues:
31
The solution is using Paint, though this can be tricky as well. The code below only works if you have the BMP files specified.
DEFINE CLASS Navigator AS Toolbar

   lPainted = .f.
   Caption = "Navigator"
   Height = 58
   Left = 0
   Top = 0
   Width = 95
   ControlBox = .F.
   ShowTips = .T.
   Name = "Navigator"

   ADD OBJECT cmdFirst AS cmdVCR WITH ;
      Top = 11, ;
      Left = 5, ;
      ZOrderSet = 0, ;
      ToolTipText = [Go to FIRST Record...], ;
      Name = "cmdFirst"

   ADD OBJECT cmdPrevious AS cmdVCR WITH ;
      Top = 11, ;
      Left = 26, ;
      ZOrderSet = 1, ;
      ToolTipText = [Go to PREVIOUS Record...], ;
      Name = "cmdPrevious"

   ADD OBJECT cmdNext AS cmdVCR WITH ;
      Top = 11, ;
      Left = 47, ;
      ZOrderSet = 2, ;
      ToolTipText = [Go to NEXT Record...], ;
      Name = "cmdNext"

   ADD OBJECT cmdLast AS cmdVCR WITH ;
      Top = 11, ;
      Left = 68, ;
      ZOrderSet = 3, ;
      ToolTipText = [Go to LAST Record...], ;
      Name = "cmdLast"

   PROTECTED PROCEDURE Init
      THIS.Dock(0)
      THIS.Visible = .T.
   ENDPROC
   PROCEDURE Release
      RELEASE THIS
   ENDPROC
   PROCEDURE Moved
      THIS.lPainted = .f.
   ENDPROC
   PROCEDURE Resize
      THIS.lPainted = .f.
   ENDPROC
   PROCEDURE AfterDock
      THIS.lPainted = .f.
      THIS.Paint()
   ENDPROC
   PROCEDURE Undock
      THIS.lPainted = .f.
   ENDPROC
   PROCEDURE Paint
      IF THIS.lPainted
         NODEFAULT
         RETURN
      ENDIF
      DODEFAULT()
      LOCAL llDefault
      WITH THIS
         DO CASE
            CASE INLIST(THIS.DockPosition, 0, 3) && Top or Bottom
               llDefault = .t.
            CASE INLIST(THIS.DockPosition, 1, 2) && Left or Right. Undocked = -1
               llDefault = .f.
            CASE .cmdFirst.Top = .cmdPrevious.Top
               llDefault = .t.
            CASE .cmdNext.Top = .cmdLast.Top
               llDefault = .t.
            CASE .cmdPrevious.Top = .cmdNext.Top
               llDefault = .t.
         ENDCASE
         IF llDefault
            .SetDefaultPictures()
         ELSE
            .SetVerticalPictures()
         ENDIF
      ENDWITH
      THIS.lPainted = .t.
      NODEFAULT
   ENDPROC
   PROCEDURE SetDefaultPictures
      WITH THIS
         .cmdFirst.Picture    = [RecFirst.BMP]
         .cmdPrevious.Picture = [RecPrev.BMP]
         .cmdNext.Picture     = [RecNext.BMP]
         .cmdLast.Picture     = [RecLast.BMP]
      ENDWITH
   ENDPROC
   PROCEDURE SetVerticalPictures
      WITH THIS
         .cmdFirst.Picture    = [UpTop.BMP]
         .cmdPrevious.Picture = [UpArrow.BMP]
         .cmdNext.Picture     = [DnArrow.BMP]
         .cmdLast.Picture     = [DnBottom.BMP]
      ENDWITH
   ENDPROC
ENDDEFINE
DEFINE CLASS cmdVCR AS CommandButton

   Height = 22
   Width = 22
   Caption = []
   Visible = .T.

ENDDEFINE
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform