Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Compute Hours, Minutes, Seconds from SECONDS()
Message
De
09/09/1999 00:01:59
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
08/09/1999 03:38:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00261364
Message ID:
00262735
Vues:
16
>I'll have to try your time textbox/Active-X trick. Do you already have a class for it? I'd like to see it if you do. Thanks!

Here is its code.
**************************************************
*-- Class:        cnttimecontrol (d:\vfpclasses\global.vcx)
*-- ParentClass:  container
*-- BaseClass:    container
*-- Control to get a time in AM, PM notation
*
DEFINE CLASS cnttimecontrol AS container


  Width = 78
  Height = 23
  BackStyle = 0
  BorderWidth = 0
  Name = "cnttimecontrol"

  *-- Holds control source
  ControlSource = .F.


  ADD OBJECT txttime AS textbox_ WITH ;
    ControlSource = "", ;
    Left = 0, ;
    TabIndex = 11, ;
    Top = 0, ;
    Width = 77, ;
    loverridewidth = .T., ;
    Name = "txtTime"


  ADD OBJECT oletime AS olecontrol WITH ;
    Top = 0, ;
    Left = 0, ;
    Height = 20, ;
    Width = 77, ;
    Visible = .F., ;
    Name = "OleTime"


  PROCEDURE Init
    WITH this
      .txttime.controlsource = .Controlsource
      .txttime.init()
      .oletime.Init()
    ENDWITH
  ENDPROC


  PROCEDURE txttime.GotFocus
    NODEFAULT
    this.visible = .f.
    WITH this.Parent.oletime
      .visible = .t.
      .Setfocus()
    ENDWITH
  ENDPROC


  PROCEDURE oletime.Init
    this.Second	= 0
    WITH this.Parent.txttime
      IF !empty(.value)
        this.Hour	= hour(  ctot(dtoc(date())+" "+.value))
        this.Minute = minute(ctot(dtoc(date())+" "+.value))
      ELSE
        this.Hour	= 0
        this.Minute = 0
      ENDIF
    ENDWITH
  ENDPROC


  PROCEDURE oletime.LostFocus
    this.visible = .f.
    WITH this.Parent.txttime
      .value = ttoc(ctot(dtoc(date())+;
        " "+padl(this.hour,2,"0") + ;
        ":"+ padl(this.minute,2,"0")),2)
      .visible = .t.
      .valid()
      .refresh()
    ENDWITH
  ENDPROC


ENDDEFINE
*
*-- EndDefine: cnttimecontrol
**************************************************
"Set seconds off" and "set hours to 12" in DE.beforeopentables or form.load.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform