xsharp.eu • Using DTP:IsNone - Page 2
Page 2 of 5

Using DTP:IsNone

Posted: Sun Jun 23, 2019 12:41 pm
by Jamal
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!"

Using DTP:IsNone

Posted: Sun Jun 23, 2019 1:03 pm
by BiggyRat
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.

I can't see how it should be this hard. Surely if you can set a property in the IDE, then you must be able to change it programmatically...

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....

Using DTP:IsNone

Posted: Sun Jun 23, 2019 1:15 pm
by Chris
Nobody is "against" you, the problem is only that you are posting problems that are real to you, but unfortunately we cannot reproduce them in our machines, so we cannot give you a helpful solution or suggestion. This is probably happening because there is something specific in your applications that we are not thinking about (hence Jamal's "crystal ball"), but it will be made clear if you prepare and send us an aef reproducing the problem. Do not worry, we are all adults here, nobody wants to find an opportunity in your code to "badmouth" you, we all just want to help.

Using DTP:IsNone

Posted: Sun Jun 23, 2019 1:20 pm
by Jamal
This has nothing to do with skip()! It's probably a combination of things; like how you are setting the time strings which I see is showing seconds and sometimes not. The class I posted need to be adjusted to your exact needs and you have to parse the time correctly based on the stored value in your db time field.

If you need help in this 'community forum', post your code and a sample that replicates the issue, otherwise, sorry I cannot help any further.

Using DTP:IsNone

Posted: Sun Jun 23, 2019 1:46 pm
by BiggyRat
LMAO! I'm not that paranoid Chris, but I do know the way I have my aef files won't please you guys one iota. I have since changed my ways, but this app has the old way... ALL screens/forms in one MEF, Servers in another etc. I'll extract the relevant stuff put them in another aef and see how it goes.

Using DTP:IsNone

Posted: Sun Jun 23, 2019 2:03 pm
by lumberjack
Hi Jeff,
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.
Please bear with us. The logic says something like the following need to happen:

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
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....
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.

Using DTP:IsNone

Posted: Sun Jun 23, 2019 2:05 pm
by Karl-Heinz
Hi Jamal,

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:

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 made 4 changes - all marked with // New KHR - and now in my x# App :-) - the time values are shown correctly when i skip or check/uncheck the Time checkbox. It is important that when a time value is set that the struture is also filled with a valid date. Therefore i added the Today() values ! Though the SetDateTime() Method calls:

SendMessage(SELF:Handle(), DTM_GETSYSTEMTIME, 0, LONG(_CAST, @sDate))

there´s no garanty that at this moment the Time Picker holds a valid date.

regards
Karl-Heinz

Using DTP:IsNone

Posted: Sun Jun 23, 2019 2:19 pm
by lumberjack
Hi Karl-Heinz,
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:
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...

Using DTP:IsNone

Posted: Sun Jun 23, 2019 5:21 pm
by Jamal
Hi Karl,

I have the VO 2.8 Sp4 GUI SDK and a bug stems from the fact that a today's date is not set, but your code is almost similar to the MyTimePicker class I posted where I also set a dToday variable so the time DTP is assigned successfully . In my tests it worked perfectly.

May be Jeff needs to override his Next and Previous record method, parse the time in 24-hour format and set the inherited oDTP:SelectedTime := cValid24HourTime, for example oDTP:SelectedTime := "19:30:00"

The MyTimePicker class shows an example.

Jamal

Using DTP:IsNone

Posted: Sun Jun 23, 2019 7:12 pm
by Karl-Heinz
Hi Jamal,

I think it´s enough to override the VO SetDateTime() as described and inherit from this class. When you add an output to this method you´ll see that this method is called each time the value has changed. If the new class works with my X# App it must work with VO -SP4- too. Because you´re running SP4: Do you see a difference to the X# SetDateTime() code ?.

See SetDateTime sources

regards
Karl-Heinz