GRID COLUMNVALID problem

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
Zimbo
Posts: 50
Joined: Mon Nov 05, 2012 1:28 pm
Location: Scotland
Has thanked: 12 times
Been thanked: 13 times
Contact:

GRID COLUMNVALID problem

Post by Zimbo » Fri Mar 29, 2019 11:15 am

Hello fellow coders.

I have a small but irritating problem when using COLUMNVALID in a GRID. The logic works fine and I am able to display an error message when the date entered is invalid. What I want to get rid of is the pop-up message that follows my error message (the one that says "Invalid Entry").

This is the code block that validates a date entry. It sends the new date (THIS.CELLVALUE) and a date to validate against which is contained in a combobox (Win_User.Cbo_WeekEnd.VALUE) to a function called ValJobDate(). This is where the date is validated and an error message displayed. This works perfectly EXCEPT when an invalid date is found. When that happens, my error message is displayed, the ValJobDate() function ends and then I get the "Invalid Entry" message.

Can anyone point me in the right direction to find a way to stop this from happening?

Thanks. Zimbo

Code: Select all

COLUMNVALID    { { || ValJobDate(THIS.CELLVALUE, CTOD(aWeeks[Win_User.Cbo_WeekEnd.VALUE])) } , , , , , , , }

Code: Select all

FUNCTION ValJobDate(dNewDate, dEndDate)

IF EMPTY(dNewDate)
    MSGINFO("You must enter a valid date. Please try again.", "Data Validation - Invalid Job Date")
    RETURN .F.
ENDIF

IF dNewDate <= dEndDate .AND. dNewDate >= (dEndDate - 6)    // Date validation
        RETURN .T.
    ELSE
        MSGINFO("The date you entered cannot be later than " + DTOC(dEndDate) + " or earlier than " + ;
                DTOC(dEndDate - 6) + " . Please try again.", "Data Validation - Invalid Job Date")
        RETURN .F.
ENDIF

RETURN NIL
Attachments
SS1.png
SS1.png (7.85 KiB) Viewed 247 times
SS2.png
SS2.png (4.33 KiB) Viewed 247 times

User avatar
gfilatov
Posts: 617
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 22 times
Been thanked: 173 times
Contact:

Post by gfilatov » Fri Mar 29, 2019 12:09 pm

Hello Zimbo,

You can take a look for the following forum's discussion at

http://hmgforum.com/viewtopic.php?f=5&t=4773

:idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

Zimbo
Posts: 50
Joined: Mon Nov 05, 2012 1:28 pm
Location: Scotland
Has thanked: 12 times
Been thanked: 13 times
Contact:

Post by Zimbo » Fri Mar 29, 2019 1:41 pm

Thank you, gfilatov. I will look at that when I get a chance this weekend.

Zimbo
Posts: 50
Joined: Mon Nov 05, 2012 1:28 pm
Location: Scotland
Has thanked: 12 times
Been thanked: 13 times
Contact:

Post by Zimbo » Sun Mar 31, 2019 6:04 am

I have spent some time looking at this today and managed to get rid of the default warning "Invalid Entry".

To do this, I opened the file h_grid.prg (found in HMG.3.4.4 \SOURCE folder), went to line 1522 and commented out the line MSGEXCLAMATION ( _HMG_SYSDATA [ 136 ][11] by adding // at the start of the line.

After saving the file, I opened a command line window and ran the batch file BuildAllLib32.bat (in the HMG.3.4.4 folder). This rebuilt the HMG libraries and put a copy of the rebuilt libraries (*.h) in the HMG.3.4.4\LIB folder.

I then rebuilt and tested my application and can confirm the "Invalid Entry" warning has now gone.

Phew!

I have learnt a great deal from this, so thank you for pointing me in the right direction. I would love to know how I could build my own libraries as I have a number of UDF's that I'd like to include in a library. I guess this might be possible using one of the entries in BuildAllLib32.bat as a template and then make sure I copy the new UDF library to the LIB folder. Not sure if that library will be included in application builds automatically, though.

I will explore this at a later date unless anyone has already done this or knows how too?

Thank you all again!

Z

Post Reply