Using DTP:IsNone

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

Using DTP:IsNone

Post 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!"
BiggyRat

Using DTP:IsNone

Post 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....
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Using DTP:IsNone

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

Using DTP:IsNone

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

Using DTP:IsNone

Post 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.
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

Using DTP:IsNone

Post 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.
______________________
Johan Nel
Boshof, South Africa
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

Using DTP:IsNone

Post 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
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

Using DTP:IsNone

Post 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...
______________________
Johan Nel
Boshof, South Africa
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

Using DTP:IsNone

Post 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
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

Using DTP:IsNone

Post 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
Post Reply