Solved

Auto select alias in visual foxpro

Posted on 2007-11-28
6
168 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
[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
6 Comments
 
LVL 8

Accepted Solution

by:
mikegagnon earned 250 total points
ID: 20372777
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
ID: 20375501
or you can use the 'IN' clause most of the time to work with the table/workarea
0
 
LVL 42

Expert Comment

by:pcelba
ID: 23580291
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
ID: 41592307
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 42

Expert Comment

by:pcelba
ID: 41592308
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
We take a look at some of the most common obstacles that IT teams run into as they work relentlessly to keep all the alarms and sirens from going off at once.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

707 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