i. Whatever value I keyed-in doesn't stick (in other words, not saved).
ii. The combobox displays 'Sunday' as 'Su' only.
Here's a self-contained sample.
Code: Select all
#include "fivewin.ch"
#include "xbrowse.ch"
function test()
local bColor
local aDay := {"None","Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
local obrw, obold, obtncnl, oDlg
dbcreate("person", {{"empno" , "c", 8, 0}, ;
{"name" , "c",40, 0}, ;
{"proxyno", "c",20, 0}, ;
{"timein" , "c", 5, 0}, ;
{"timeout", "c", 5, 0}, ;
{"tea_m" , "n", 2, 0}, ;
{"lunch_min", "n", 2, 0}, ;
{"tea_a" , "n", 2, 0}, ;
{"others_min","n", 2, 0}, ;
{"weekend1","c", 9, 0}, ;
{"weekend2","c", 9, 0}, ;
{"halfday" ,"c", 9, 0} ;
} ;
)
use person new exclusive
append blank
person->empno := "E0000001"
person->name := "John Doe"
person->proxyno := "00123"
person->timein := "09:00"
person->timeout := "18:00"
person->lunch_min := 60
person->weekend1 := "Sunday"
person->weekend2 := "Saturday"
append blank
person->empno := "E0000002"
person->name := "Jane Doe"
person->proxyno := "00122"
person->timein := "09:00"
person->timeout := "18:00"
person->lunch_min := 60
person->weekend1 := "Sunday"
person->weekend2 := "Saturday"
DEFINE FONT oBold NAME 'VERDANA' SIZE 0,-14 BOLD
DEFINE DIALOG oDlg RESOURCE "SETTINGS"
redefine xbrowse oBrw id 13 of oDlg ;
fields person->(recno()), person->empno, person->name, person->proxyno, ;
person->timeIn, person->timeOut, person->tea_m, person->lunch_min, ;
person->tea_a, person->others_min, person->weekend1, person->weekend2, ;
person->halfday ;
headers "No", "Code", "Name", " Proxy Card Number", "In", "Out", "Morning"+CRLF+"Tea", ;
"Lunch", "Afternoon"+CRLF+"Tea", "Others", "WeekEnd1", "WeekEnd2", "Half-Day" ;
pictures ,,,replicate("9", len(person->proxyno)),"99:99","99:99","99","99","99","99" ;
alias ('person') fastedit lines cell //update
oBrw:lAllowColSwapping := .f.
AEval( oBrw:aCols, { |o| o:nEditType := EDIT_GET }, 4 )
oBrw:aCols[5]:bEditValid := {|oGet, oCol| verifyTime(oGet:value())}
oBrw:aCols[6]:bEditValid := {|oGet, oCol| verifyTime(oGet:value())}
with object oBrw:WeekEnd1
:nEditType := EDIT_LISTBOX
:aEditListTxt := aDay
end
with object oBrw:WeekEnd2
:nEditType := EDIT_LISTBOX
:aEditListTxt := aDay
end
oBrw:aCols[13]:nEditType := EDIT_LISTBOX
oBrw:aCols[13]:aEditListTxt := aDay
oBrw:SetGroupHeader("Employee", 2, 3, oBold)
oBrw:SetGroupHeader("Time", 5, 6, oBold)
oBrw:SetGroupHeader("In minutes", 7, 10, oBold)
REDEFINE BUTTON oBtnCnl ID 62 OF oDlg action oDlg:end()
ACTIVATE DIALOG oDlg center on init oBrw:gotop()
return nil
//----------------------------------------------------------------------
function verifytime(cTime)
local hrs := val(left(cTime,2)), mins := val(right(cTime,2))
local lRet := .t.
if hrs < 0 .or. hrs > 23
lRet := .f.
else
if mins < 0 .or. mins > 59
lRet := .f.
endif
endif
if !lRet
msgalert("Valid time values are from 00:00 to 23:59 only!")
endif
return lRet
Code: Select all
SETTINGS DIALOG 9, 60, 400, 271
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "Employees' Settings"
FONT 10, "System"
{
CONTROL "", 13, "TXBrowse", 0 | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | WS_BORDER | WS_TABSTOP, 0, 0, 396, 250
CONTROL "E&xit", 62, "button", BS_PUSHBUTTON | BS_CENTER | WS_CHILD | WS_VISIBLE, 196, 255, 60, 14
}
TIA.