?
Solved

Auto select alias in visual foxpro

Posted on 2007-11-28
6
Medium Priority
?
263 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
5 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 43

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 43

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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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…
Currently, there is an issue with being able to copy values from an external application to a dropdown list in Project Web Access (PWA).  The standard copy and paste methods don't seem to work properly. Here is a way to accomplish this task to s…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

850 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