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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP7 Help for application distribution....

Status
Not open for further replies.

MAliShah

Programmer
Nov 22, 2002
27
Hi all,
I m new to VFP7. So I will be posting questino again and again. I m developing application (executable) for user. At present I m not using Forms for input data rather I m using simple coding for data entry. So far I m facing following problems
1. When I click on the screen other than menu the message 'Syntax Error' displayed and it is refered to the loop for selecting menue option (I coded for menu,popup, and pad)in the progame file.
2. I used array for the help of users of the details for a particular feild. Now to select an item from user I want to use 'Enter' key but it does not work.
I hope I will get these solution very soon.
Thanks in advance
 
While my first question would normally be "Why are you not using the Form Designer and the Menu Designer in VFP 7.0?", I'd just simply suggest that you need to provide some code that is failing - it's unlikely anyone here can guess what's wrong without it.

Rick
 
MAliShah,

I m new to VFP7. So I will be posting questino again and again

Welcome to VFP, and to the forum.

I have to agree with Rick on this one. The technique you are using is not the usual way of programming a user interface. VFP provides the ability to code menus and popups in that way mainly as a compatibility feature -- to support old "pre-Visual" applications.

Unless you've got a very good reason for doing otherwise, I'd suggest you abandon what you have done so far, and start exploring the form designer, and then later the menu builder.

Mike




Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Hi Mike and Rick,
Thank u very much for geering me up for forms designer. I had to finish my task with in stipulated time for that reason I had no option but to complete the task anyway. Now I got some time from my boss to work on form designing. I took this initiative so ur help will be very much required.
1. How to store the field displayed in the text box for furthere reference, query and store in the table
2. If a variable (say ID) has many dimention e.g if id=1 I need just amount, if id=2 I need currency information(local or foreign)+ amount, if id=3, i need currency+particular sector+amount and so on. I want to apply checks on ID so that only relevent dimentions will be displayed on the form
Please guide me.
Regards and thanks in advance
Malishah
 
Malishah,

How to store the field displayed in the text box for furthere reference, query and store in the table [/i

You need to use the Value property of the textbox. To access that property, use:

THISFORM.Text1.Value

where Text1 is the name of the text box. So, to store the contents of the text box in a variable:

MyVariable = THISFORM.Text1.Value

Also, you can set the text box's ControlSource property to the name of a field in a table. When you do that, the text box will always display the contents of the field. And when the user edits the textbox, the edits will be saved in the table.

If a variable (say ID) has many dimention e.g if id=1 I need just amount... I want to apply checks on ID so that only relevent dimentions will be displayed on the form

You need to write code in the LostFocus event of the ID textbox. This code can enable or disable the other textboxes, depending on the value of the ID. For example.

IF THIS.Value = "1"
THISFROM.txtCurrency.,Enable = .F.
THISFORM.txtAmount.Enabled = .F.
ELSE
IF THIS.Value = "2"
THISFROM.txtCurrency.,Enable = .T.
THISFORM.txtAmount.Enabled = .F.
etc. etc.

Hope this answers your questions.

Mike




Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Mike, Thank u very much.
The code worked and helped me a lot. Now more
1) I want the user to select ID from the master table. I used combo box to get the id list with description. But in this way every time the user have to chose a variable from the list. I want that user enter an id code and the description of this code be displayed as read only with cursor moving automatically to the next option. And, if the Id code is not available in the master file then the help be available for chosing the required ID. Is combo box is the right option for such action?
2) Any guide/tip for most used properties/events etc.
Thanks and regards
Malishah
 
Malishah,

OK, you need a texbox for the user to enter the ID. Also, place a label next to the textbox. Make the caption of the label an empty string.

In the Valid event of the textbox, write code which checks to see if the ID is present in the table. If it is, get its description and store that in the caption property of the label. Then return .T. from the Valid.

If the ID is not present, display an error message and return .F.

Also, if the textbox is empty, skip the above check. Just return .T.

In the textbox's GotFocus, store an empty string to the label's caption.

I think that'll do what you want.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Dear Mike,
I m again. Sorry for asking very basic questions. Itried the following code in the valid event of text box for ID.

mvid=thisform.vr.Value
USE variable
LOCATE FOR variable.id=mvid
IF NOT FOUND()
WAIT WINDOW "Variable not found"
return=.f.
ENDIF
IF FOUND()
STORE variable.variable TO mvariable
return=.t.
ENDIF
IF EMPTY(mvid)
return=.t.
ENDIF
Return=.t.
************
If the id is not available the eror message is displayed but the cursor to moved to the next place instead of remaining in the id textbox. Similar case if the ID is empty
I also need the help for user to locate Id from the list etc if he/she don't has list of Id
2) The description in the lable is not displayed. Perhaps I could not understand the linkages of "Caption of the label an empty string" although I tried many alternatives.
Thanks in advance.
 
Instead of
Code:
    return=.f.
* try:
    return .f. && or .T.
RETURN is command, not a variable.

Rick
 
Malisha,

Rick's reply should solve the first of your problems.

I also need the help for user to locate Id from the list etc if he/she don't has list of Id

What form should the help take? Do you want to display a helpful message explaining the problem? If so, you can use MESSAGEBOX(). Or do you want to give the user a list of the IDs that they can choose from? The best way to do that is to use a combo box. In fact, if you use a combo box instead of the text box, you wouldn't have to do any validation at all, as they user would only be able to pick an existing value.

The description in the lable is not displayed. Perhaps I could not understand the linkages of "Caption of the label an empty string"

I was thinking of something like:

THISFORM.MyLabel.Caption = ""

Hope this helps.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Thanks Mike and Rick. Stars for both.
Next!
1)I used combo box for user entry. Everything is right but it seems unfreindly for user to dropdown every time he/she enter the ID codes. Is there any option in the combo box that the user can write a Id code without droping down everytime.
2)There are many entries for a given date/month for example. I want the user to chose the date/month option once and the control remain within the inner loop till the other option is opted.
3) What codes are used to Get into the form and leaving out of the form programatically
Thanks
 
MAliShah,

it seems unfreindly for user to dropdown every time he/she enter the ID codes

The whole point of a combo is that the user never has to enter the code; they can just pick the corresponding description from the list.

I agree that it is tedious for the user to have to scroll down a long list when they could just as easily type a short code. The solution is to make sure that the IncrementalSearch property of the combo is .T. That way, the uesr can start typing the description, and as they hit each key, the highlight will move closer to the required entry.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top