I have a date/time picker set to time format. When I set the time eg 10:25:44 PM, on writing it back to the database, it drops back to AM.
The rest of it is stored correctly. My obvious question is WHY?
I've done the setAM/PM thing, made sure the field is long enough and (I think the right type - character) etc
Any ideas please?
Hopefully last question for a while.
Hopefully last question for a while.
Please provide more information, is it the VOGUI, WinForms or WPF date control?
What database, DataTable/SQL or simple DBF?
Can you please show some code, how you are loading and saving the value?
What database, DataTable/SQL or simple DBF?
Can you please show some code, how you are loading and saving the value?
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Hopefully last question for a while.
Ah sorry, just now made the connection, just saw your question also in the VO newsgroup!
So apparently you are using VOGUI and DBF in VO, please do post the code you are using to load and save the value though.
So apparently you are using VOGUI and DBF in VO, please do post the code you are using to load and save the value though.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Hopefully last question for a while.
Hi Chris,
I think the problem lies in not being able to access the value returned by the time and also a date picker control. Basically, this is it:
I have a screen called "JobInfo" it's a relational set up (Client info from DBServer Client DBF in Master, JobInfo) and a Date Picker and Time Picker (2 separate controls) In the SUBFORM of JobInfo, called JobInfo_Details which contains the details of the actual job number for that particular client in a many-to-one relationshio. (Many Jobs (subform) to one Client Code (main form)
The problem is this code in the "UPDATE" Button in the main screen, JobInfo says that bothe DateTimePicker1 and DateTimePicker2 are out of scope or can't be found. I can't see any way to access the selected Date and Time.
I've crawled over every forum, user guide, help files etc but with help like
DateTimePicker:SelectedTime Access/Assign
Description
A string (format "HH:MM:SS") specifying the currently selected time."
and
DateTimePicker:SelectedDate Access/Assign
Description
A date specifying the currently selected date.
From the actual VO "help" file (I'm using the term "help" VERY loosely here) I can't seem to access the required info.
I think the problem lies in not being able to access the value returned by the time and also a date picker control. Basically, this is it:
I have a screen called "JobInfo" it's a relational set up (Client info from DBServer Client DBF in Master, JobInfo) and a Date Picker and Time Picker (2 separate controls) In the SUBFORM of JobInfo, called JobInfo_Details which contains the details of the actual job number for that particular client in a many-to-one relationshio. (Many Jobs (subform) to one Client Code (main form)
The problem is this code in the "UPDATE" Button in the main screen, JobInfo says that bothe DateTimePicker1 and DateTimePicker2 are out of scope or can't be found. I can't see any way to access the selected Date and Time.
I've crawled over every forum, user guide, help files etc but with help like
DateTimePicker:SelectedTime Access/Assign
Description
A string (format "HH:MM:SS") specifying the currently selected time."
and
DateTimePicker:SelectedDate Access/Assign
Description
A date specifying the currently selected date.
From the actual VO "help" file (I'm using the term "help" VERY loosely here) I can't seem to access the required info.
- lumberjack
- Posts: 727
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Hopefully last question for a while.
Hi Jeff,
You will have to show us the code of how this Window was actually created...
I think you actually describing your problem yourself here, but without code it is not that easy to assist. I will try and explain from my understanding...BiggyRat wrote: I think the problem lies in not being able to access the value returned by the time and also a date picker control. Basically, this is it:
I have a screen called "JobInfo" it's a relational set up (Client info from DBServer Client DBF in Master, JobInfo) and a Date Picker and Time Picker (2 separate controls) In the SUBFORM of JobInfo, called JobInfo_Details which contains the details of the actual job number for that particular client in a many-to-one relationshio. (Many Jobs (subform) to one Client Code (main form)
The problem is this code in the "UPDATE" Button in the main screen, JobInfo says that both the DateTimePicker1 and DateTimePicker2 are out of scope or can't be found. I can't see any way to access the selected Date and Time.
Code: Select all
CLASS JobInfo
PROTECT oJobDetail AS JobDetail
METHOD dtPickerAccess()
SELF:DateTimePicker1:SelectedTime // Out of scope, can't be found
SELF:DateTimePicker2:SelectedTime // Out of scope, can't be found
SELF:oJobDetail:DateTimePicker1:SelectedTime // This will be in scope and found
SELF:oJobDetail:DateTimePicker2:SelectedTime // This will be in scope and found
RETURN
END CLASS
CLASS JobDetail
EXPORT DateTimePicker1, DateTimePicker2 AS DateTimePicker
END CLASS
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa
Hopefully last question for a while.
Hi Johan, thanks for the information, I hope this enough for you to go on...
Code: Select all
METHOD Init(oWindow,iCtlID,oServer,uExtra) CLASS JobInfo_DETAIL
LOCAL olServer AS OBJECT
LOCAL DIM aFonts[3] AS OBJECT
LOCAL DIM aBrushes[3] AS OBJECT
self:PreInit(oWindow,iCtlID,oServer,uExtra)
SUPER:Init(oWindow,ResourceID{"JobInfo_DETAIL",_GetInst()},iCtlID)
aFonts[1] := Font{,10,"Microsoft Sans Serif"}
aFonts[1]:Bold := TRUE
aFonts[2] := Font{,10,"Microsoft Sans Serif"}
aFonts[3] := Font{,11,"Microsoft Sans Serif"}
aFonts[3]:Bold := TRUE
aBrushes[1] := Brush{Color{COLORYELLOW}}
aBrushes[2] := Brush{Color{COLORBLACK}}
aBrushes[3] := Brush{Color{239,239,239}}
oDCJOBNUMBER := SingleLineEdit{SELF,ResourceID{JOBINFO_DETAIL_JOBNUMBER,_GetInst()}}
oDCJOBNUMBER:FieldSpec := DETAILS_JOBNUMBER{}
oDCJOBNUMBER:HyperLabel := HyperLabel{#JOBNUMBER,"Job Number:",NULL_STRING,"DETAILS_JOBNUMBER"}
oDCJOBNUMBER:TextColor := Color{COLORRED}
oDCJOBNUMBER:BackGround := aBrushes[1]
oDCJOBNUMBER:Font(aFonts[1], FALSE)
oDCJOBFIN := CheckBox{SELF,ResourceID{JOBINFO_DETAIL_JOBFIN,_GetInst()}}
oDCJOBFIN:HyperLabel := HyperLabel{#JOBFIN,"Complete?",NULL_STRING,"DETAILS_JOBFIN"}
oDCJOBFIN:FieldSpec := DETAILS_JOBFIN{}
oDCJOBFIN:Font(aFonts[2], FALSE)
oDCPONumber := SingleLineEdit{SELF,ResourceID{JOBINFO_DETAIL_PONUMBER,_GetInst()}}
oDCPONumber:HyperLabel := HyperLabel{#PONumber,"PO Number",NULL_STRING,NULL_STRING}
oDCPONumber:FieldSpec := DETAILS_PONUMBER{}
oDCPONumber:Font(aFonts[2], FALSE)
oDCRATE := SingleLineEdit{SELF,ResourceID{JOBINFO_DETAIL_RATE,_GetInst()}}
oDCRATE:FieldSpec := DETAILS_RATE{}
oDCRATE:HyperLabel := HyperLabel{#RATE,"Rate/Price",NULL_STRING,NULL_STRING}
oDCRATE:Font(aFonts[2], FALSE)
oDCUNITS := SingleLineEdit{SELF,ResourceID{JOBINFO_DETAIL_UNITS,_GetInst()}}
oDCUNITS:HyperLabel := HyperLabel{#UNITS,"Units",NULL_STRING,NULL_STRING}
oDCUNITS:FieldSpec := DETAILS_UNITS{}
oDCUNITS:Font(aFonts[2], FALSE)
oDCComboBox1 := combobox{SELF,ResourceID{JOBINFO_DETAIL_COMBOBOX1,_GetInst()}}
olServer := RATES{}
oDCComboBox1:FillUsing(olServer,#RATETYPE,#RATETYPE)
olServer:Close()
oDCComboBox1:HyperLabel := HyperLabel{#ComboBox1,NULL_STRING,NULL_STRING,NULL_STRING}
oDCComboBox1:FieldSpec := DETAILS_RATETYPE{}
oDCComboBox1:Font(aFonts[2], FALSE)
oDCRego := SingleLineEdit{SELF,ResourceID{JOBINFO_DETAIL_REGO,_GetInst()}}
oDCRego:HyperLabel := HyperLabel{#Rego,"Registration",NULL_STRING,NULL_STRING}
oDCRego:Font(aFonts[2], FALSE)
oDCSubby := SingleLineEdit{SELF,ResourceID{JOBINFO_DETAIL_SUBBY,_GetInst()}}
oDCSubby:FieldSpec := DETAILS_SUBBY{}
oDCSubby:HyperLabel := HyperLabel{#Subby,"Subcontractor",NULL_STRING,NULL_STRING}
oDCSubby:Font(aFonts[2], FALSE)
oDCJOBDETAILS := MultiLineEdit{SELF,ResourceID{JOBINFO_DETAIL_JOBDETAILS,_GetInst()}}
oDCJOBDETAILS:FieldSpec := DETAILS_JOBDETAILS{}
oDCJOBDETAILS:HyperLabel := HyperLabel{#JOBDETAILS,"Job Details",NULL_STRING,"DETAILS_JOBDETAILS"}
oDCJOBDETAILS:Font(aFonts[2], FALSE)
oDCNPC := MultiLineEdit{SELF,ResourceID{JOBINFO_DETAIL_NPC,_GetInst()}}
oDCNPC:HyperLabel := HyperLabel{#NPC,"Non Printing Comments","Text placed in this field DOES NOT appear on any standard report. It can however be used in a custom report.","Text placed in this field DOES NOT appear on any standard report. It can however be used in a custom report."}
oDCNPC:FieldSpec := DETAILS_NPC{}
oDCNPC:UseHLforToolTip := True
oDCNPC:Font(aFonts[2], FALSE)
oDCSC_JOBDATE := FixedText{SELF,ResourceID{JOBINFO_DETAIL_SC_JOBDATE,_GetInst()}}
oDCSC_JOBDATE:HyperLabel := HyperLabel{#SC_JOBDATE,"Job Date:",NULL_STRING,NULL_STRING}
oDCSC_JOBDATE:Font(aFonts[2], FALSE)
oDCSC_JOBTIME := FixedText{SELF,ResourceID{JOBINFO_DETAIL_SC_JOBTIME,_GetInst()}}
oDCSC_JOBTIME:HyperLabel := HyperLabel{#SC_JOBTIME,"Job Time:",NULL_STRING,NULL_STRING}
oDCSC_JOBTIME:Font(aFonts[2], FALSE)
oDCGroupBox1 := GroupBox{SELF,ResourceID{JOBINFO_DETAIL_GROUPBOX1,_GetInst()}}
oDCGroupBox1:HyperLabel := HyperLabel{#GroupBox1," Job Details ",NULL_STRING,NULL_STRING}
oDCGroupBox1:Font(aFonts[1], FALSE)
oDCSC_JOBNUMBER := FixedText{SELF,ResourceID{JOBINFO_DETAIL_SC_JOBNUMBER,_GetInst()}}
oDCSC_JOBNUMBER:HyperLabel := HyperLabel{#SC_JOBNUMBER,"Job Number:",NULL_STRING,NULL_STRING}
oDCSC_JOBNUMBER:Font(aFonts[2], FALSE)
oDCFixedText4 := FixedText{SELF,ResourceID{JOBINFO_DETAIL_FIXEDTEXT4,_GetInst()}}
oDCFixedText4:HyperLabel := HyperLabel{#FixedText4,"Customer PO:",NULL_STRING,NULL_STRING}
oDCFixedText4:Font(aFonts[2], FALSE)
oDCFixedText5 := FixedText{SELF,ResourceID{JOBINFO_DETAIL_FIXEDTEXT5,_GetInst()}}
oDCFixedText5:HyperLabel := HyperLabel{#FixedText5,"Quoted Price: $",NULL_STRING,NULL_STRING}
oDCFixedText5:Font(aFonts[2], FALSE)
oDCFixedText6 := FixedText{SELF,ResourceID{JOBINFO_DETAIL_FIXEDTEXT6,_GetInst()}}
oDCFixedText6:HyperLabel := HyperLabel{#FixedText6,"Per Rate Type:",NULL_STRING,NULL_STRING}
oDCFixedText6:Font(aFonts[2], FALSE)
oDCFixedText7 := FixedText{SELF,ResourceID{JOBINFO_DETAIL_FIXEDTEXT7,_GetInst()}}
oDCFixedText7:HyperLabel := HyperLabel{#FixedText7,"Registration:",NULL_STRING,NULL_STRING}
oDCFixedText7:Font(aFonts[2], FALSE)
oDCFixedText8 := FixedText{SELF,ResourceID{JOBINFO_DETAIL_FIXEDTEXT8,_GetInst()}}
oDCFixedText8:HyperLabel := HyperLabel{#FixedText8,"Subcontractor:",NULL_STRING,NULL_STRING}
oDCFixedText8:Font(aFonts[2], FALSE)
oDCGroupBox2 := GroupBox{SELF,ResourceID{JOBINFO_DETAIL_GROUPBOX2,_GetInst()}}
oDCGroupBox2:HyperLabel := HyperLabel{#GroupBox2," Non-Printing Comments ",NULL_STRING,NULL_STRING}
oDCGroupBox2:Font(aFonts[1], FALSE)
oDCFixedText9 := FixedText{SELF,ResourceID{JOBINFO_DETAIL_FIXEDTEXT9,_GetInst()}}
oDCFixedText9:HyperLabel := HyperLabel{#FixedText9,"Invoice Total:",NULL_STRING,NULL_STRING}
oDCFixedText9:Font(aFonts[2], FALSE)
oDCFixedText11 := FixedText{SELF,ResourceID{JOBINFO_DETAIL_FIXEDTEXT11,_GetInst()}}
oDCFixedText11:HyperLabel := HyperLabel{#FixedText11,"Units:",NULL_STRING,NULL_STRING}
oDCFixedText11:Font(aFonts[2], FALSE)
oDCSingleLineEdit10 := SingleLineEdit{SELF,ResourceID{JOBINFO_DETAIL_SINGLELINEEDIT10,_GetInst()}}
oDCSingleLineEdit10:HyperLabel := HyperLabel{#SingleLineEdit10,NULL_STRING,NULL_STRING,NULL_STRING}
oDCSingleLineEdit10:TextColor := Color{COLORYELLOW}
oDCSingleLineEdit10:BackGround := aBrushes[2]
oDCSingleLineEdit10:Font(aFonts[1], FALSE)
oDCSLEInvtxt := FixedText{SELF,ResourceID{JOBINFO_DETAIL_SLEINVTXT,_GetInst()}}
oDCSLEInvtxt:HyperLabel := HyperLabel{#SLEInvtxt,NULL_STRING,NULL_STRING,NULL_STRING}
oDCSLEInvtxt:BackGround := aBrushes[3]
oDCSLEInvtxt:TextColor := Color{255,0,0}
oDCSLEInvtxt:Font(aFonts[3], FALSE)
oDCDateTimePicker2 := DateTimePicker{SELF,ResourceID{JOBINFO_DETAIL_DATETIMEPICKER2,_GetInst()}}
oDCDateTimePicker2:HyperLabel := HyperLabel{#DateTimePicker2,"DateTimePicker2",NULL_STRING,NULL_STRING}
oDCDateTimePicker3 := DateTimePicker{SELF,ResourceID{JOBINFO_DETAIL_DATETIMEPICKER3,_GetInst()}}
oDCDateTimePicker3:HyperLabel := HyperLabel{#DateTimePicker3,NULL_STRING,NULL_STRING,NULL_STRING}
SELF:Caption := ""
SELF:HyperLabel := HyperLabel{#JobInfo_DETAIL,NULL_STRING,NULL_STRING,NULL_STRING}
SELF:Menu := StandardShellMenu{}
if !IsNil(oServer)
SELF:Use(oServer)
ELSE
SELF:Use(DETAILS{})
ENDIF
self:Browser := DataBrowser{self}
oDBJOBNUMBER := DataColumn{DETAILS_JOBNUMBER{}}
oDBJOBNUMBER:Width := 11
oDBJOBNUMBER:HyperLabel := oDCJOBNUMBER:HyperLabel
oDBJOBNUMBER:Caption := "Job Number:"
oDBJOBNUMBER:TextColor := Color{COLORRED}
oDBJOBNUMBER:BackGround := aBrushes[1]
self:Browser:AddColumn(oDBJOBNUMBER)
oDBCLCODE := DataColumn{DETAILS_CLCODE{}}
oDBCLCODE:Width := 12
oDBCLCODE:HyperLabel := HyperLabel{#CLCODE,"Code",NULL_STRING,"DETAILS_CLCODE"}
oDBCLCODE:Caption := "Code"
self:Browser:AddColumn(oDBCLCODE)
oDBJOBDATE := DataColumn{DETAILS_JOBDATE{}}
oDBJOBDATE:Width := 8
oDBJOBDATE:HyperLabel := HyperLabel{#JobDate,"Date",NULL_STRING,NULL_STRING}
oDBJOBDATE:Caption := "Date"
self:Browser:AddColumn(oDBJOBDATE)
oDBJOBTIME := DataColumn{DETAILS_JOBTIME{}}
oDBJOBTIME:Width := 8
oDBJOBTIME:HyperLabel := HyperLabel{#JobTime,"Time",NULL_STRING,NULL_STRING}
oDBJOBTIME:Caption := "Time"
self:Browser:AddColumn(oDBJOBTIME)
oDBDNAME := DataColumn{DETAILS_DNAME{}}
oDBDNAME:Width := 17
oDBDNAME:HyperLabel := HyperLabel{#DNAME,"Driver",NULL_STRING,NULL_STRING}
oDBDNAME:Caption := "Driver"
self:Browser:AddColumn(oDBDNAME)
oDBJOBDETAILS := DataColumn{DETAILS_JOBDETAILS{}}
oDBJOBDETAILS:Width := 38
oDBJOBDETAILS:HyperLabel := oDCJOBDETAILS:HyperLabel
oDBJOBDETAILS:Caption := "Job Details"
self:Browser:AddColumn(oDBJOBDETAILS)
oDBPONUMBER := DataColumn{DETAILS_PONUMBER{}}
oDBPONUMBER:Width := 18
oDBPONUMBER:HyperLabel := oDCPONUMBER:HyperLabel
oDBPONUMBER:Caption := "PO Number"
self:Browser:AddColumn(oDBPONUMBER)
oDBRATE := DataColumn{DETAILS_RATE{}}
oDBRATE:Width := 11
oDBRATE:HyperLabel := oDCRATE:HyperLabel
oDBRATE:Caption := "Rate/Price"
self:Browser:AddColumn(oDBRATE)
oDBRATETYPE := DataColumn{DETAILS_RATETYPE{}}
oDBRATETYPE:Width := 12
oDBRATETYPE:HyperLabel := HyperLabel{#RATETYPE,"Rate Type",NULL_STRING,NULL_STRING}
oDBRATETYPE:Caption := "Rate Type"
self:Browser:AddColumn(oDBRATETYPE)
oDBUNITS := DataColumn{DETAILS_UNITS{}}
oDBUNITS:Width := 9
oDBUNITS:HyperLabel := oDCUNITS:HyperLabel
oDBUNITS:Caption := "Units"
self:Browser:AddColumn(oDBUNITS)
oDBSUBBY := DataColumn{DETAILS_SUBBY{}}
oDBSUBBY:Width := 34
oDBSUBBY:HyperLabel := oDCSUBBY:HyperLabel
oDBSUBBY:Caption := "Subcontractor"
self:Browser:AddColumn(oDBSUBBY)
oDBREGO := DataColumn{24}
oDBREGO:Width := 24
oDBREGO:HyperLabel := oDCREGO:HyperLabel
oDBREGO:Caption := "Registration"
self:Browser:AddColumn(oDBREGO)
oDBNPC := DataColumn{DETAILS_NPC{}}
oDBNPC:Width := 44
oDBNPC:HyperLabel := oDCNPC:HyperLabel
oDBNPC:Caption := "Non Printing Comments"
self:Browser:AddColumn(oDBNPC)
- lumberjack
- Posts: 727
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Hopefully last question for a while.
Hi Jeff,
I was looking for this portion of your code. However, I don't see the button press event code that causes all the magic troubles...
Well almost...BiggyRat wrote:Hi Johan, thanks for the information, I hope this enough for you to go on...
Code: Select all
METHOD Init(oWindow,iCtlID,oServer,uExtra) CLASS JobInfo_DETAIL
oDCDateTimePicker2 := DateTimePicker{SELF,ResourceID{JOBINFO_DETAIL_DATETIMEPICKER2,_GetInst()}}
oDCDateTimePicker2:HyperLabel := HyperLabel{#DateTimePicker2,"DateTimePicker2",NULL_STRING,NULL_STRING}
oDCDateTimePicker3 := DateTimePicker{SELF,ResourceID{JOBINFO_DETAIL_DATETIMEPICKER3,_GetInst()}}
oDCDateTimePicker3:HyperLabel := HyperLabel{#DateTimePicker3,NULL_STRING,NULL_STRING,NULL_STRING}
return self
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa
Hopefully last question for a while.
Sorry, here it is Johan:
Code: Select all
METHOD UpdateButton( ) CLASS JobInfo
LOCAL oTB as TextBox
IF self:server:RLOCK(self:server:RECNO)
self:server:Commit()
self:oSFJobInfo_DETAIL:SingleLineEdit10 := ("$ " + AllTrim((Str(self:oSFJobInfo_DETAIL:RATE*self:oSFJobInfo_DETAIL:UNITS))))
if self:oSFJobInfo_DETAIL:CurrentView == #FormView
self:oSFJobInfo_DETAIL:FIELDPUT(#RateType, AllTrim(self:oSFJobInfo_DETAIL:ComboBox1))
endif
// self:oSFJobInfo_DETAIL:
// self:oSFJobInfo_DETAIL:FIELDPUT(#JOBDATE, self:oSFJobInfo_DETAIL:JOBDATE)
// self:oSFJobInfo_DETAIL:FIELDPUT(#JOBTIME, something.... )
self:oSFJobInfo_DETAIL:server:Commit()
self:Browser:Refresh()
self:oCCNewJobButton:Enable()
ELSE
oTB := TextBox{ self, cAppVersion,;
"This record cannot be updated at present, as it is currently being accessed by another user" }
oTB:Type := BUTTONOKAY + BOXICONASTERISK
oTb:Show()
ENDIF
RETURN NIL
Hopefully last question for a while.
Jeff,
"self:oSFJobInfo_DETAIL:FIELDPUT(#RateType, AllTrim(self:oSFJobInfo_DETAIL:ComboBox1))"
What should the Alltrim return?
Karl
"self:oSFJobInfo_DETAIL:FIELDPUT(#RateType, AllTrim(self:oSFJobInfo_DETAIL:ComboBox1))"
What should the Alltrim return?
Karl
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Hopefully last question for a while.
Jeff,
IF self:server:RLOCK(self:server:RECNO)
self:server:Commit()
You are not writing anything to the server, so why bother locking and committing ?
And then later
self:oSFJobInfo_DETAIL:FIELDPUT(#RateType, AllTrim(self:oSFJobInfo_DETAIL:ComboBox1))
self:oSFJobInfo_DETAIL:server:Commit()
You did not lock self:oSFJobInfo_DETAIL:server
Why use manual locking on one server and not on the other ?
Robert
IF self:server:RLOCK(self:server:RECNO)
self:server:Commit()
You are not writing anything to the server, so why bother locking and committing ?
And then later
self:oSFJobInfo_DETAIL:FIELDPUT(#RateType, AllTrim(self:oSFJobInfo_DETAIL:ComboBox1))
self:oSFJobInfo_DETAIL:server:Commit()
You did not lock self:oSFJobInfo_DETAIL:server
Why use manual locking on one server and not on the other ?
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu