I cringe whenever I look at some of my older forms and notice they still use native controls.
My standard protocol is to base all of my controls on a class I built as a standard PRG that defines every single native control with the same name but with my own prefix.
Everything else is a...
Yes. You are correct. I was thinking more about custom controls. I tend to have tons of my own classes and totally custom methods that I either enhance by pushing my DODEFAULT() somewhere at the top or bottom, in in some cases as I mentioned, conditionally depending on some condition.
Good
Good point. I forgot to mention the option to NOT run the default at all.
I generally use a DODEFAULT() somewhere in my overrides, especially of my custom controls.
Sometimes I want my default code run first, sometimes last, and other times last. When using code like this on a custom...
Valid is still the best place to validate something and its entire purpose is to allow the method to prevent the user from moving to the another control without first making sure it's an acceptable value. So in a nutshell Valid always fires before LostFocus because you can't lose focus until...
For any validation, I still prefer the Valid event because it's more concrete and is always triggered whenever the textbox changes, and has built-in functionality to ensure you can't leave it until it's valid without needing any hacks.
However, if the initial value is critical and has the...
I mentioned the MessageBox in a prior post, but in some cases you simply can't leave critical fields blank so you need to do more than just warn the user.
If a required field like a date is missing for booking a trip or for an accounting record, the record is useless, so you need to either...
I'm not a fan of locking people into a field either, but in many cases, something like a date is essential to data integrity.
In cases like that, if empty is not allowed or if they enter something wrong, I'll populate it with something like the previous value or a default such as today's date...
There is no need to use SetFocus. It will remain in that box until it returns a true valid either way.
Just use:
if empty(this.value)
** optionally set the color to red.
return .f.
else
** optionally set the color back to white.
return .t.
endif
If the box is empty, it will...
I agree with the other replies but I'd like to clarify that LostFocus always fires after Valid, which is means LostFocus will not execute until Valid allows you to leave the box.
The fact that it turned red means that it did lose focus when LostFocus detected the blank date.
What is more of...
I'm not a fan of data environments because I like the freedom of letting my customers switch directory paths and manage data for entirely different companies, so I open dbf files programmatically before loading forms or in the load event. This gives me freedom of which dbf files to open and...
It looks like you are trying to execute the form after you've released it. As far as I know, any lines after releasing the form will not execute.
The cleanest way to handle this is to keep the first form active, but potentially invisible.
For example:
thisform.visible = .f.
do form...
For what it's worth, I used this feature for a while when it first came out, and it works seamlessly once you set things up.
I eventually migrated all my local SQL Servers to Azure SQL, which doesn't support FileTables or FileStreams, which wasn't an issue for me because I never used any of the...
I do likewise. My older apps store files in a series of folders (year\month), then I store a pointer to the files.
My newer versions uploads files in an Azure Blob, so instead of storing the path locally, I store them in the cloud, and reference the cloud container and path.
But at one point...
Yes... that definitely should work. Unlike trying to use single quotes, the SQLExec function should be able to correctly format it whenever you use ? followed by a variable or field reference.
Inserting using a simple string like that won't work for a variety of reasons, including the fact that even a single character that happens to be another single quote will terminate the first one.
There are a lot of alternatives, but the approach I use for things like that are updatable remote...
I just love a good thought experiment, and I said, my main intention was to clarify that FP was not the source of the shortened names, because the operating system manages them, and that the OP should be aware that there are scenarios where the short name can change.
I ran into this type of...
Here's a quick example of how things have the *potential* to change.
I copied the original file Test.doc multiple times, and gave it a long extension (DOCX) to illustrate some scenarios.
The original test.doc has no short name. When you add a long extension, things get interesting. It needs...
Fair enough.
Just to be clear, I used FoxPro's .BAK as an example of the fact that many programs have ways to save a version that can be used to recover previous versions. FoxPro's method is via .BAK files, MS Office creates hidden files with alternate prefixes, etc.. We can't know for sure...
Well said. The key phrase being "...as they are".
So the bottom line is if a program only needs to refer to files as they are right now, you can absolutely trust the short names.
However, any long term assumptions about the short names being the same years later are dependent on whether those...
Yes... but only if the contents of the directory are guaranteed to be static.
Windows creates the 8.3 filename once a file enters a directory and it definitely won't change it unless the files are copied to another location that potentially has existing files with the same 8.3 filename as it's...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.