?
Solved

Auto select alias in visual foxpro

Posted on 2007-11-28
6
Medium Priority
?
193 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 1000 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

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…
Hey fellow admins! This time, I have a little fairy tale for you. As many tales do, it starts boring and then gets pretty gory. I hope you like it. TL;DR: It is about an important security matter, you should read it if you run or administer Windows …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

801 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