Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Tõnis Pihlakas
  Where is Tõnis Pihlakas?
 Tallinn
 Estonia
 Tõnis Pihlakas
 To: Lucy Alice Pilanga
  Where is Lucy Alice Pilanga?
 Metro Manila
 Philippines
 Lucy Alice Pilanga
 Tags
Subject: RE: TimeTextBox + Grid
Thread ID: 33936 Message ID: 33941 # Views: 2 # Ratings: 0
Version: Visual FoxPro 8 Category: Grids
Date: Friday, December 05, 2003 9:59:31 AM         
   


Well, the point is that I don't want to save anything to c_temp myself, I'm hoping that Fox will do it for me. The value is stored as a string inside the textbox's .Value property and as a float in c_temp. To illustrate it, I'll show the code:

TimeTextBox's properties:
.Format = 'R'
.InputMask = '99:99'


<< value_access >>
LOCAL nHours,nMinutes

nHours = VAL(SUBSTR(this.Value,1,2))
nMinutes = VAL(SUBSTR(this.Value,3,2))
RETURN (nHours+(nMinutes/60))

<< value_assign >>
LPARAMETERS vNewVal
LOCAL cNewValue, nHours, nMinutes

IF VARTYPE(vNewVal) <> "C"
nHours = INT(vNewVal)
nMinutes = (vNewVal-nHours)*60
THIS.Value = cNewValue
ELSE
this.Value = vNewVal
ENDIF

<< Valid >>
LOCAL nHours,nMinutes,lAllowExit
lAllowExit = .T.
IF VARTYPE(this.Text)="C"
nHours=VAL(SUBSTR(this.Text,1,AT(":",this.Text)-1))
nMinutes=VAL(SUBSTR(this.Text,AT(":",this.Text)+1))
IF nHours>23 .OR. nMinutes>59
lAllowExit=.F.
ELSE
this.Value=PADL(ALLTRIM(STR(nHours)),2,"0")+PADL(ALLTRIM(STR(nMinutes)),2,"0")
ENDIF
ENDIF

IF lAllowExit
RETURN .T.
ELSE
RETURN .F.
ENDIF

A Quick Brown Fox Jumps Over The Lazy Dog

ENTIRE THREAD

TimeTextBox + Grid Posted by Tõnis Pihlakas @ 12/5/2003 8:59:28 AM
RE: TimeTextBox + Grid Posted by Lucy Alice Pilanga @ 12/5/2003 9:35:59 AM
RE: TimeTextBox + Grid Posted by Tõnis Pihlakas @ 12/5/2003 9:59:31 AM
RE: TimeTextBox + Grid Posted by Lucy Alice Pilanga @ 12/5/2003 10:16:49 AM
RE: TimeTextBox + Grid Posted by Tõnis Pihlakas @ 12/5/2003 10:31:37 AM
RE: TimeTextBox + Grid Posted by Ken Blum @ 12/5/2003 4:40:56 PM
RE: TimeTextBox + Grid Posted by Tõnis Pihlakas @ 12/8/2003 4:38:10 PM
RE: TimeTextBox + Grid Posted by Tõnis Pihlakas @ 12/8/2003 6:20:29 PM
RE: TimeTextBox + Grid Posted by Ken Blum @ 12/8/2003 8:36:04 PM
RE: TimeTextBox + Grid Posted by Tõnis Pihlakas @ 12/9/2003 1:41:52 PM
RE: TimeTextBox + Grid Posted by Ken Blum @ 12/9/2003 4:27:04 PM
RE: TimeTextBox + Grid Posted by Tõnis Pihlakas @ 12/10/2003 8:17:23 AM
RE: TimeTextBox + Grid Posted by Tõnis Pihlakas @ 12/11/2003 9:26:04 AM
RE: TimeTextBox + Grid Posted by Ken Blum @ 12/11/2003 5:51:30 PM