Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. Joe Crescenzi

    SetFocus not working

    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...
  2. Joe Crescenzi

    SetFocus not working

    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.
  3. Joe Crescenzi

    SetFocus not working

    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...
  4. Joe Crescenzi

    SetFocus not working

    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...
  5. Joe Crescenzi

    SetFocus not working

    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...
  6. Joe Crescenzi

    SetFocus not working

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

    SetFocus not working

    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...
  8. Joe Crescenzi

    SetFocus not working

    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...
  9. Joe Crescenzi

    SetFocus not working

    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...
  10. Joe Crescenzi

    Selecting record from a Grid for use in another form

    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...
  11. Joe Crescenzi

    Selecting record from a Grid for use in another form

    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...
  12. Joe Crescenzi

    Inserting Image into varbinary(max) field

    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...
  13. Joe Crescenzi

    Inserting Image into varbinary(max) field

    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...
  14. Joe Crescenzi

    Inserting Image into varbinary(max) field

    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.
  15. Joe Crescenzi

    Inserting Image into varbinary(max) field

    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...
  16. Joe Crescenzi

    long vs short filenames

    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...
  17. Joe Crescenzi

    long vs short filenames

    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...
  18. Joe Crescenzi

    long vs short filenames

    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...
  19. Joe Crescenzi

    long vs short filenames

    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...
  20. Joe Crescenzi

    long vs short filenames

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

Part and Inventory Search

Back
Top