[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Another VFP focus question/problem

Posted on 2010-09-16
9
Medium Priority
?
758 Views
Last Modified: 2012-08-14
Thanks to you guys I have the form working, the colors the way I want in the grid and the horizontal scroll working but since I added the error message if there was not a hit on delivery # back in, I am having problems. I spent the last hour playing and can not figure out how to solve it.

Here are the 3 problems problem in the jpg.:

Tracking # screen

Here is the code I have in #1 (txt_Search_deliv). If I uncomment out the "ThisForm.txt_Search_deliv.SetFocus", I get an error that says: "Cannot call SetFocus from within a When, Valid, RangeHigh or RangeLow event."

Select Label

If NOT Empty(ThisForm.txt_Search_deliv.value)
      Set Filter To label.deliv_num = AllTrim(ThisForm.txt_Search_deliv.value)
      Locate
      IF NOT FOUND()
       Messagebox("No records found for the entered Delivery #, please try again.",0, "Assign Tracking Numbers")
*            ThisForm.txt_Search_deliv.SetFocus
    ENDIF
Endif

GO TOP
ThisForm.grdLabel.refresh()


Thanks again!
0
Comment
Question by:cafulford
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 4

Expert Comment

by:wcsoctu
ID: 33695118
Number 3 is:
ThisForm.txt_Search_deliv.Value='' before the SeFocus line
0
 
LVL 4

Accepted Solution

by:
wcsoctu earned 1000 total points
ID: 33695576
Not saying this is the best way, but:
In the LOAD
    PUBLIC  BackToDelivery
    BackToDelivery=.F.

In the Valid of the delivery box, when you determine it is not found:
     BackToDelivery=.T.

In the GotFocus of the next object:
IF BackToDelvery
     BackToDelivery=.F.
     thisform.txt_Search_Deliv.SetFocus
ENDIF
0
 
LVL 30

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 1000 total points
ID: 33695623
The error message is clearly saying what you can't do, so you can't do that. You forgot to mention but I know from your previous posts, that the line ThisForm.txt_Search_deliv.SetFocus actually is in the valid event of that textbox. You can instead RETURN 0 to stay in the textbox.

But you are causing a problem by this, if the user simply wants to close the form he can't unless a valid delivery # is entered. I would not recommend to put the effort into the automatic movement of the focus. As in any windows application you can use TAB to tab forward in controls and SHIFT+TAB to tab back. You can also add a hotkey by setting the caption of the button "Enter another delivery #" by setting the caption to eg "\<Enter another delivery #", this way The E of Enter will be underlined and ALT+E is a hotkey to "press" this button.

Then in the Click() event of that button you can put the Setfocus code and user can use ALT+E or, if the button has focus, use RETURN to enter another delivery number. Anyway the form can be used with keyboard ony, I see that needing to use the mouse is contraproductive for quickly entering tracking # for several delivery #, but I'd say that is sufficient already.

Bye, Olaf.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 30

Expert Comment

by:Olaf Doschke
ID: 33699681
This is an unusual close request. I don't see any reason for us to object about getting points assigned...Usually you make a close request, when you want a refund only.

Bye, Olaf.
0
 

Author Comment

by:cafulford
ID: 33700721
I am not sure what happened. I just wanted to assign the points as usual. I am not sure how it was set up as a close request or how I can close it out as I usually do...
0
 
LVL 30

Expert Comment

by:Olaf Doschke
ID: 33704552
Don't bother, the closing will be done automatically, it'll just be happening delayed.
0
 

Author Comment

by:cafulford
ID: 33712016
Olaf,

One last question on this: If they click on #2 (for whatever reason before they entered anything in #1), it automatically shows all records in the label.dbf file. Is there a way to prevent any lookups if they click on #2?

Thanks,

Charlie
0
 

Author Comment

by:cafulford
ID: 33712020
Also, let me know if you want me to open up another ticket so points can be awarded...
0
 
LVL 30

Expert Comment

by:Olaf Doschke
ID: 33712192
That's simply because you have the code to filter the data in #1 Valid event. When focus is lost you filter, if no delivery # is entered the filter is se to an empty string which is fullfilled by all records due to the way foxpro compares strings. If you don't want that, have an extra case in the code setting the filter to a condition no record fulfills.

You don't need to open another ticket for this advice, thanks anyway.

Bye, Olaf.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
An overview of cyber security, cyber crime, and personal protection against hackers. Includes a brief summary of the Equifax breach and why everyone should be aware of it. Other subjects include: how cyber security has failed to advance with technol…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question