Solved

Auto select alias in visual foxpro

Posted on 2007-11-28
6
89 Views
Last Modified: 2016-05-28
I'm using Visual Foxpro 8.0

1. Manual
Create two freetable as name DBF1 and DBF2
Create form as name FORM1 and adding :
- GRID1 : property RecordSource = 'DBF1'
- GRID2 : property RecordSource = 'DBF2'
- CommandButton1

2. Typing this code in test.prg
* Open two table
Use DBF1 in 0 Alias DBF1
Use DBF2 in 0 Alias DBF2
Select 0 && work-area is empty
* Call Form
Do form FORM1

3. Problem :
- When GRID1 has focus, foxpro auto select to work-area DBF1 ( can see in statusbar)
- When GRID2 has focus, foxpro auto select to work-area DBF2
- When CommandButton1 has focus, foxpro auto select to work-area DBF1 : why.

Why foxpro don't still work-area when focus change from GRID2 to CommandButton1 ( CommandButton1 haven't averything code )

Thank
0
Comment
Question by:levanquan
6 Comments
 
LVL 8

Accepted Solution

by:
mikegagnon earned 250 total points
Comment Utility
Can you explain what exactly is the problem?
If Foxpro decides to switch between aliases depending what has focus, is that a problem?
When you want to do something with specific table, just select the alias, for example in your command button click event put SELECT DBF2, it will switch alias for you.
0
 
LVL 8

Expert Comment

by:suhashegde
Comment Utility
or you can use the 'IN' clause most of the time to work with the table/workarea
0
 
LVL 41

Expert Comment

by:pcelba
Comment Utility
It is a feature. FoxPro simply remembers the last known non-empty workarea and selects it when you move focus to some data independent control. So in your scenario the workarea could even be DBF2 when you press Command button:

SELECT 0, run the form, set focus to GRID2, then to GRID1, then to Command button - and the work area will change to DBF2...

So you have either select the right work area in your command button (if it is known) or you have to store the current workarea in each grid to some form property and use the stored value in command button.
0
 

Expert Comment

by:EE_AutoDeleter
Comment Utility
I've requested that this question be deleted for the following reason:

No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Not enough information to confirm an answer.

If you feel this question should be closed differently, post an objection and a moderator will read all objections and then close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Experts-Exchange Auto Deleter
0
 
LVL 41

Expert Comment

by:pcelba
Comment Utility
It seems the AI of auto deleter is not too advanced yet :-).

All answers are still valid and explain what should we expect from VFP when switching between grids and other UI controls.

All answers also offer work around. No reason for question deletion. I would say split the points but looking at mikegagnon's total score he should obtain all points to qualify for the new rank in FoxPro zone.

So accept the first answer (ID: 20372777) as the solution please.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Marketing can be an uncomfortable undertaking, especially if your material is technology based. Luckily, we’ve compiled some simple and (relatively) painless tips to put an end to your trepidation and start your path to success.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now