Using DTP:IsNone
Posted: Sun Jun 23, 2019 12:41 pm
I don't have my crystal ball. It's jumped off a 10-story building window and it's screaming in agony "BiggyRat, post a bare-bones AEF that clearly shows your problem!"
Please bear with us. The logic says something like the following need to happen:BiggyRat wrote:You need a crystal ball to understand how a skip(1) and skip(-1) works? The record is clearly changing correctly, but the checkbox component isn't. No crystal ball needed. It's there in black and white.
Code: Select all
oWin:Server := YourDbf
oWin:Server:GoTop()
WHILE !oWin:Server:Eof
// Populate the DTP:Control
MessageBox(....)
oWin:Server:Skip()
ENDDO
METHOD Scatter() CLASS ...
LOCAL fld
IF !Empty(fld := SELF:Server:FieldGet(#YourField) )
SELF:DTP:Value := fld
ELSE
SELF:DTP:Value ....
ENDIF
RETURN
We not asking you to put the AEF here, but a small example of 1 single window with a DatePicker/TimePicker on it and a skip next/previous button, and a small two column DBF emulating what you are doing in your code with maybe 5-6 records for us to work on would go a long way in assisting. I can assure you your problem would probably have been solved in an hour or two, or confirmed that there is a "bug" in VO that we unfortunately would not be able to fix or code like Jamal gave you might be able to create a workaround.Besides, if I put the aef here, it would just give more ammunition to be used against me, as I know it's not the way you guys would have done it....
Code: Select all
CLASS myDTP INHERIT DateTimePicker
//
// Override the SetDateTime() Method
//
METHOD SetDateTime(dNewDate AS DATE, sNewTime AS STRING) AS VOID STRICT CLASS myDTP
// Suggestion from Håkon Clausen and Dirk Herijgers
LOCAL sDate IS _winSYSTEMTIME
LOCAL dwFlag AS DWORD
LOCAL dToday AS DATE // new KHR
// if no date or time given. Reset to default values and uncheck
IF dNewDate == NULL_DATE .AND. SLen(sNewTime) == 0
// clear the control
IF SELF:lNullFormat=FALSE
SELF:cOldFormat := SELF:Format
ENDIF
SELF:Format := "''"
SELF:lNullFormat := TRUE
dwFlag := GDT_NONE
ELSE
SELF:Format := cOldFormat
SELF:lNullFormat := FALSE
dwFlag := GDT_VALID
// get current value from control and set the parts that are given
SendMessage(SELF:Handle(), DTM_GETSYSTEMTIME, 0, LONG(_CAST, @sDate))
IF dNewDate != NULL_DATE
sDate:wDay := LoWord(Day(dNewDate))
sDate:wMonth := LoWord(Month(dNewDate))
sDate:wYear := LoWord(Year(dNewDate))
ENDIF
IF SLen(sNewTime) > 0
dToday := Today()
sDate:wDay := Day ( dToday ) // new KHR
sDate:wMonth := Month ( dToday ) // new KHR
sDate:wYear := Year ( dToday ) // new KHR
sDate:wHour := Val(Left(sNewTime, 2))
sDate:wMinute := Val(SubStr(sNewTime, 4,2))
sDate:wSecond := Val(SubStr(sNewTime, 7,2))
ENDIF
ENDIF
SendMessage(SELF:Handle(), DTM_SETSYSTEMTIME, dwFlag, LONG(_CAST, @sDate))
RETURN
I think you touching on the issue here. It is like in .NET Control:Text is used to retrieve/set values, but when you on a ComboBox the :Text property is not used. Same with the DTP, you need to trap the "SET" and channel it to use SetDateTime() etc. VO spoiled us in that :Value could be used to assign most, but it might be that DTP was not 100% compatible with this approach...Karl-Heinz wrote: looking at your posted code i had an idea and looked at the DTP SDK-sources. I do not have SP4 - only SP3 - installed, but i think the X# VO-SDK sources are equal to VO SP4, where some enhancements have been made to the DTP. SP4 has the SetDateTime() method: