Sunteți pe pagina 1din 14

Frequently Asked Questions for Microsoft Visual FoxPro 6.

0 for Windows These are some of the most frequently asked questions about Visual FoxPro. Pleas e scan this list before you call Microsoft Technical Support. To print these notes, choose Print from the File menu. This document is divided into the following four parts: --------------------------------------------------------------------Part 1. Support and Marketing Part 2. Visual FoxPro 6.0 New Features Part 3. Migration from other version of FoxPro Part 4. Common Visual FoxPro questions --------------------------------------------------------------------Part 1. Support and Marketing Question 1-1: Where can I find product updates? Answer: The best place to get information on product updates, including Service Packs and updated samples, wizards, and other code, is on the Visual FoxPro Web site at the following URL location: www.microsoft.com/vfoxpro Please check the Web site on a regular basis to download the latest updates. Question 1-2: Where can I go for more information about Visual FoxPro? Answer: The best way to keep abreast of all new product announcements is throug h the Microsoft Visual FoxPro Web site. In addition to new product announcements , this site also features product updates, technical articles, white papers, coo l samples from expert developers, conference announcements, and links to many ot her FoxPro web sites. Question 1-3: How do I obtain product support and report bugs? Answer: The Microsoft Visual FoxPro Web site has links to a variety of online s upport options including the extensive Microsoft Knowledge Base of all products. You can also access a list of Frequently Asked Questions. In addition to online support, you can also call for direct product support. The Help menu has an opt ion listing technical support phone numbers. These numbers can also be used to r eport issues that you think may be product bugs. Question 1-4. What is the Knowledge Base and how do I use it? Answer: The Knowledge Base is an extensive list of articles covering how to use product features, known bugs and their resolution or workarounds, and other usef ul information to help you use various Microsoft products. The entire Knowledge Base is available online at the following URL location: support.microsoft.com Question 1-5: Will there be a Visual FoxPro 6.0a? Answer: Microsoft is committed to producing high quality products. If the need arises we may provide bug-fixes for Visual FoxPro 6.0. However, these would not be in a 6.0a release. Any bug fixes to Visual FoxPro 6.0 would be included in Vi sual Studio Service Packs. These would be announced on either the Visual FoxPro www.microsoft.com/vfoxpro or the Visual Studio www.microsoft.com/vstudio Web sit

es. Question 1-6: Microsoft offers a number of great solutions for developing appli cations. How do I know which product to use and recommend to my clients? Answer: There are a number of factors that go into choosing the right product f or a job. The Microsoft Visual FoxPro web site contains an excellent strategy ba ckgrounder paper describing the differences between Microsoft products like Visu al FoxPro, Visual Basic, SQL Server, and Access. Question 1-7: Where do I find samples using Visual FoxPro? Answer: Visual FoxPro 6.0 ships with an extensive collection of samples includi ng a number of new ones for 6.0 specific features. Unlike prior versions of Visu al FoxPro, the samples are now installed in a location for all Visual Studio sam ples. You must choose to install the samples by running a Custom setup. In Visua l FoxPro, use the new HOME(2) function to easily find the location of the sample s you chose to install. In addition to shipping samples, the Microsoft Visual FoxPro web is frequently u pdated with new samples. Question 1-8: Many times I will read an article on the Microsoft web site and s ee sample code for Visual Basic and Visual C++. Does this mean I can not use Vis ual FoxPro? Answer: No. Particularly when it comes to calling and using objects, the syntax in Visual Basic and Visual FoxPro is almost identical. You can usually take Vis ual Basic code and quickly change it into the correct syntax for Visual FoxPro. The similarity in syntax also means that, often, the code in a Visual Basic book or magazine is highly useful to Visual FoxPro developers. Question 1-9: I've been using Visual FoxPro for years? Why should I upgrade to Visual Studio? Answer: Microsoft Visual Studio is the ultimate application development solutio n for professional developers. As application development becomes more focused o n component-based systems that integrate client/server and the Internet, it is n ecessary to have a wealth of tools that meet the demands of today's developer an d the changing needs of businesses. Microsoft Visual Studio offers a complete se t of tools for the professional developer. Visual Studio Professional Edition in cludes Visual FoxPro, Visual Basic, Visual C++, Visual J++, and Visual InterDev. Visual Studio Enterprise Edition includes those five tools plus Visual SourceSa fe and SQL Server. Question 1-10: How can I obtain additional marketing related information as wel l as requesting participation in future betas of Visual FoxPro? Answer: Send mail to the following email address: foxmktg@microsoft.com There is no guarantee that you will be selected as a beta participant since the number of people requesting to be on the beta often exceeds the number of availa ble slots. --------------------------------------------------------------------Part 2. Visual FoxPro 6.0 New Features Question 2-1: What's new in Visual FoxPro 6.0?

Answer: There are many exciting new features in version 6.0. These include custo m Automation server improvements, Active Documents, OLE Drag and Drop support, A ccess and Assign methods, and the Component Gallery to name just a few. For more information on new features and new language, click "What's New" on the Visual FoxPro Start Page in the MSDN Library browser. Question 2-2: What is an Active Document and when should I use it? How does it differ from Active Documents in Visual Basic? Answer: Active Documents are a way of deploying your Visual FoxPro applications on the intranet. You can use Active Documents to run forms created with Visual F oxPro, containing Visual FoxPro code, directly in the Microsoft Internet Explore r web browser. In Visual Basic, Active Documents are merely forms that have been modified sligh tly to support features specific to Internet Explorer. Active Documents in Visua l FoxPro are slightly different. The ActiveDoc class is a non-visual class that acts more like an application object handling events necessary to run existing V isual FoxPro forms in the browser. Therefore, the conversion of forms is not nec essary. Several new properties including form ScrollBars and TitleBar properties were added to conform to user interface standards when hosted in Internet Explo rer. It is important to understand that the Visual FoxPro ActiveDoc you run in Intern et Explorer is merely an application (.app) file that could be run directly with in Visual FoxPro. Because of this, the run-time version of Visual FoxPro is requ ired. Therefore, Active Documents are more suitable for intranet environments wh ere constraints of downloading the large Visual FoxPro run-time files are not as severe as over the Internet where most users use modems to gain access. The goo d news is that the run-time files need to be downloaded only once. Question 2-3: What is the difference between OLE Drag and Drop, and the Drag an d Drop that existed in Visual FoxPro 5.0? Answer: Prior to this version, Visual FoxPro supported Drag and Drop between for ms and controls on these forms. This type of Drag and Drop was proprietary to Vi sual FoxPro, which meant that you could not drag to and from other non Visual Fo xPro applications. With this version, Visual FoxPro now supports true OLE Drag and Drop, which is t he same type of Drag and Drop used by other Windows-based applications. Your app lications can now use this standard to support drag and drop of data between oth er applications such as Microsoft Excel and Word. Question 2-4: Why are there two application wizards? Answer: In an effort to simplify application development for Visual FoxPro devel opers, many new features were added to version 6.0 including a new Application F ramework, Application Builder, and Component Gallery. The older Application Wiza rd that shipped with version 5.0 is included for backward compatibility. The new er wizard, which simply asks for a project name and location, simplifies the ent ire application creation process. Question 2-5: What is the difference between a Project object and a ProjectHook object? Answer: Whenever a project (.pjx) file is opened, a Project object is created. T his project can be referenced with the following code: _VFP.ActiveProject

The Project object has properties for all the information available in the Proje ct Information dialog box, including Collections for files and servers. Because developers want to interact with various events associated with a projec t, such as adding files or doing builds, it was necessary to create a new class (ProjectHook) to support code for these events. ProjectHook classes are optional for a project. If a ProjectHook class is specif ied for a project (as specified in the Project Information dialog box), it is in stantiated when the project is opened (this includes commands such as BUILD APP) , and destroyed when the project is closed. Question 2-6: How can I add check boxes in my ListBox control? Answer: A commonly requested enhancement has been to add check box support to th e Visual FoxPro native ListBox control. The new version of the Microsoft ActiveX ListView control as well as the Treeview control now support check boxes. These controls ship with Visual FoxPro 6.0 (see Question 2-7). Question 2-7: My Visual FoxPro 5.0 forms containing certain controls such as Li stView or TreeView do not inherit the latest features of these controls (such as check box support). Distributed applications with these forms do not function c orrectly on end-user machines because of an OLE error with the form. Answer: In version 6.0, the file containing the following ActiveX controls was renamed from Comctl32.ocx to Mscomctl.ocx: Microsoft Microsoft Microsoft Microsoft Microsoft Microsoft Microsoft Microsoft ListView Control TreeView Control ImageList Control ProgressBar Control StatusBar Control Slider Control Tabstrip Control Toolbar Control

Even though Visual FoxPro 6.0 upgrades to the new Mscomctl.ocx file, older versi on 5.0 forms with these controls will still reference the older file since the A ctiveX control is bound by its OleClass property. ActiveX controls from the olde r Comctl32.ocx file have a version of 1. For example, the OleClass property for a ListView control on a 5.0 form would say: COMCTL.ListViewCtrl.1 Newer ActiveX controls in the Mscomctl.ocx file have a version 2 (or higher). Fo r example: COMCTL.TreeViewCtrl.2 Visual FoxPro will not automatically upgrade your control, so it is important to know which version of an ActiveX control a form uses when distributing your app lications. Question 2-8: Can I create my own user-defined Collections in Visual FoxPro 6.0 ? Answer: Visual FoxPro 5.0 did not directly support the creation of Collections, which are similar to arrays of objects. The Form object's Controls property is a n example of a collection. Visual FoxPro 6.0 supports Access/Assign methods that

can be used to create real user-defined Collections. There is an excellent exam ple of this in the Solutions sample application. Question 2-9: Why don't my Visual FoxPro 5.0 Automation servers work with Micro soft Transaction Server or Active Server Pages? Answer: A number of server improvements were made in version 6.0, including supp ort for apartment-model threading to make servers scale better and run smoother in Active Server Pages and Transaction Server. Type library improvements now all ow applications such as Visual Basic to see properties and methods in command co mpletion dropdowns. You may also experience a Remote Procedure Call error using the Visual FoxPro 6. 0 or 5.0 Automation servers with Microsoft Transaction Server 2.0. If this happe ns, make sure you have at least Service Pack 1 or higher of Transaction Server 2 .0. Question 2-10: I want to write an Internet application using Visual FoxPro 6.0. There are a lot of new features for doing this. Where do I start? Answer: Visual FoxPro provides a variety of tools that you can use for creating applications to deploy over the Web. The new Web Publishing Wizard and GENHTML features are excellent tools for gener ating a variety of HTML output to publish your Visual FoxPro data. Depending on your needs, there are options for generating both static and dynamic HTML. You c an even use the Web Publishing Wizard to generate a script that can be executed at runtime to regenerate your HTML. Visual FoxPro also supports the creation of COM components (formerly known as Au tomation servers) that can be used as middle-tier objects in a web application. These objects can be deployed to access and process Visual FoxPro data natively, through ODBC or ADO as well as handling business rules. Visual FoxPro COM compo nents can be accessed directly within Active Server Pages and Microsoft Transact ion Server. You can also use the FOXISAPI extension that ships with Visual FoxPr o. This extension can be called by Microsoft Internet Information Server to requ est HTML from a Visual FoxPro COM component by invoking a method that returns th e HTML directly. The new Active Document technology is another option that allows you to take exi sting Visual FoxPro forms and run them over an Intranet setting. Because the Vis ual FoxPro runtime is required, it is not always ideal to deploy over the Intern et. Question 2-11: Why does the new Scrollbars property for forms not display scrol l bars on my form when I change this property at runtime? Answer: Before a form is created, Visual FoxPro reads the form's Scrollbars prop erty setting because the value of this property determines how a form is created . If the value of the Scrollbars property is 0 (no scroll bars), Visual FoxPro c reates a Visual FoxPro 5.0 style light-weight form. If the value of the Scrollba rs property is a value other than 0, Visual FoxPro creates a form that consumes more memory. When designing your applications, keep in mind that forms with scro ll bars require more memory. If the Scrollbars property is set to 0 at design time, the Scrollbars property a t runtime is read-only because Visual FoxPro initially creates a light-weight fo rm. However, if the Scrollbars property is set to a value other that 0 at design time, Visual FoxPro allows the Scrollbars property to be read-write at runtime because there may be code that calls the SAVEAS() function to create a new form

with scroll bars. If you have no need for scroll bars on a form (for example, th e form uses page frames), then set the Scrollbars property to 0 at runtime to sa ve memory. If the Scrollbars property is set to a value other than 0 at design-time, you ca n change the value of the Scrollbars property at runtime. However, if you change the value of the Scrollbars property to 0, Visual FoxPro hides the scroll bars on the form; a new light-weight form isn't created. --------------------------------------------------------------------Part 3. Migration from other versions of FoxPro and Visual FoxPro Question 3-1: What should I be concerned about when moving my Visual FoxPro 5.0 applications to Visual FoxPro 6.0? Answer: Visual FoxPro 5.0 applications will run as is directly in Visual FoxPro 6.0. If the code in your 5.0 application contains any references to system menu pads and bars (like _msystem), you must recompile the code. You can also create applications in 6.0 and run them in 5.0, however, if you do this, your code must not contain any new 6.0 language. Databases can be shared between the two versi ons. The file format for menu (.mnx) files has been slightly changed to accommodate n ew ActiveDoc support. If you try to open a 5.0 menu in 6.0, you will be prompted to convert to the new format. The ase ner the new menu format will be compatible with 5.0 versions of GENMENU and other XB utilities that read the .mnx file. However, the Visual FoxPro 5.0 menu desig will not be able to open the 6.0 format. To convert a 6.0 .mnx file back to 5.0 format, you can use the following command: ALTER TABLE mymenu.mnx ALTER COLUMN location N(1) However, the NEGOTIATE information for menu pads may be lost or corrupted in doi ng so. Project (.pjx) files are still the same; however, new ProjectHook information is stored in these files. Therefore, if you are using 6.0 projects with ProjectHoo ks (which are optional), you should avoid opening them in 5.0. Please read the "Upgrading" section in Help. Question 3-2: Why do I have to execute SYS(2333,0) to allow various ActiveX cont rols to work properly in Visual FoxPro 5.0? Answer: In Visual FoxPro 6.0, the default is now SYS(2333,0) so this is no longe r required. It is recommended that _vfp.AutoYield is set to .F. also. Question 3-3: What should I be concerned about when moving my Visual FoxPro 3.0 applications to Visual FoxPro 6.0? Answer: Applications written in Visual FoxPro 3.0 will need to be recompiled to run in Visual FoxPro 6.0 since the object code is not binary compatible between versions. The database (.dbc) file format between 3.0 and 5.0 was changed, so it is not pr actical to share databases between applications written in 3.0 and 6.0 unless 3. 0 users access the data through the Visual FoxPro ODBC driver (using Remote View s). The format for form (.scx) files and class (.vcx) files was modified slightly be

tween 3.0 and 5.0 (see Question 3-5). As in version 5.0, when opening a 3.0 form or class in version 6.0, the Converter is invoked. Project files were updated in version 5.0 to support source control integration. Therefore, 3.0 projects are automatically converted to support source control w hen opened in version 6.0. See Question 3-1 for more details on changes between menu and project files made between 5.0 and 6.0. Also, please read the "Upgrading" section in Help. Question 3-4: What is the cross-platform strategy for Visual FoxPro? Answer: Please read Question 3-3 above because the current version of Visual Fox Pro for Macintosh is 3.0. There are a number of alternative cross-platform solut ions for Visual FoxPro for Windows developers that should be seriously evaluated . Consider using Microsoft Internet Explorer for Macintosh as a front-end to you r Mac users. Visual FoxPro 6.0 Automation servers can be used to access Fox data and output it as HTML. The FoxISAPI utility (with new pool manager support incl uded with 6.0) is one such solution. Question 3-5: If I edit or run my Visual FoxPro 3.0 forms in Visual FoxPro 6.0, the fonts are smaller and no longer appear bold. Why does this happen and how c an I avoid this? Answer: To enable you to more easily make forms that comply with the Windows 95 standard, several default property settings for controls were changed, includin g FontSize, FontBold, and ColorSource. If these were set to default values under Visual FoxPro 3.0, they will remain defaults under Visual FoxPro 6.0. However, because the defaults are different, text will be displayed differently. If you want to have your forms appear as they did in Visual FoxPro 3.0, convert them as part of a project. Then when you open the Visual FoxPro 3.0 project in V isual FoxPro 6.0, check the Retain Visual FoxPro 3.0 Default Property Values che ck box in the Converter. Question 3-6: What should I be concerned about when moving my FoxPro 2.x applic ations to Visual FoxPro 6.0? Answer: Visual FoxPro 3.0 was a major upgrade for FoxPro developers. In fact, be cause of the paradigm shift (see Question 3-7), some people consider Visual FoxP ro an entirely new product. Because of the new object-oriented shift, most of th e file formats were changed. Visual FoxPro ships with a Converter utility that handles all file format change s. However, it does not convert your procedural code to object-oriented code exc ept for visual user interface items. It is important to know that your existing FoxPro 2.x code will still run as is. We do recommend that you migrate your sour ce to object-oriented code where possible to take advantage of many new features as well as more efficient development practices. One of the popular new features of Visual FoxPro is support for real databases ( as a collection of tables). The term "database" was often used interchangeably w ith "table" in FoxPro 2.x and prior versions. Please read the "Upgrading" section in Help. Question 3-7: When should I use object-oriented programming (OOP) instead of pro cedural programming? Is it better to create classes visually or through program code?

Answer: You can continue to use a traditional procedural programming style in V isual FoxPro if you prefer it. Most FoxPro version 2.x programs coded in procedu ral style will run with only minor modifications in Visual FoxPro. However, consider making the transition to an OOP programming style if the follo wing conditions are true: 1. Your organization currently participates in a structured, analytical process for new programming projects. 2. You are willing to invest the resources necessary to develop a library of reusable code, without realizing full payback on this investment until after the current project. 3. You want to tap the power of Visual FoxPro event handling, common code syntax, and other benefits associated with OOP. When you create a class programmatically, you must know all of the commands nece ssary to complete a task, but you can also inspect any portion of code at any ti me. If you create a class visually, you do not need to know all of the commands to complete a task, but you must look at each method individually. One of the be nefits of Visual FoxPro is the ability to add a class defined through code to a form, save the instantiated objects as a class, and then edit those classes visu ally. This functionality, combined with the ability to export code through the C lass Browser, provides the best of both types of class design tools. Question 3-8: My client's data needs have expanded. How can I move my Visual Fox Pro data to Microsoft SQL Server? Answer: Visual FoxPro ships with an Upsizing Wizard that moves FoxPro databases to SQL Server or Oracle. The Wizard has options to automatically create remote v iews in your database that access the new SQL Server data. This strategy allows you to retain existing forms and reports that access data sources with little or no modification. Question 3-9: Why is there a new Mscomctl.ocx file? Do I still need a new Comctl 32.ocx file? What are some potential issues? Answer: The Visual FoxPro 5.0 Comctl32.ocx file contains the following ActiveX c ontrols: Treeview Listview Slider Imagelist Status Bar Tabstrip Progress Bar Toolbar With Visual FoxPro 6.0, updated versions of these controls are being released in the new Mscomctl.ocx file. This was done primarily because a number of new feat ures were added to these controls such as checkbox and hover support. The following issues are important to Visual FoxPro developers: - Visual FoxPro does not automatically update ActiveX controls on forms to use t he newer version. So, existing forms that use controls such as the Treeview cont rol will still reference the old Comctl32.ocx file.

- Once a control is added to a form, you cannot update or change the version. Th is is done intentionally so that newer ActiveX control versions do not break cod e if for some reason the newer version was not backward compatible. - You can determine which version of a control you have by viewing the OleClass property of that control in the Properties window. For example: COMCTL.ListViewCtl.1 COMCTL.ListViewCtl.2 (newer Comctl32.ocx version) (newer Mscomctl.ocx version)

- It is critical that you know which version of a control your forms use for dis tribution purposes. If all your forms use the older Listview control, you wouldn 't want to ship the new Mscomctl.ocx file. The Setup Wizard lets you select the particular file to include with your distributed applications. - Another important issue for developers who have both Comctl32.ocx and Mscomctl .ocx controls installed and registered on a single machine, is to ensure that th e Mscomctl.ocx is always registered last. When you add an ActiveX control to a f orm, the Insert Object dialog box displays a list of controls. It is possible th at the dialog box does not display the latest versions of these controls. The current version gistered. So, if by Pro, you can easily gsvr32.exe from the is not always the latest version, but rather the last one re chance you register Comctl32.ocx after installing Visual Fox reset the Mscomctl.ocx file as the current one by running Re Windows Start menu -> Run dialog box. For example, run:

REGSVR32 c:\Windows\System\Mscomctl.ocx This ensures that you are always installing the latest version of these ActiveX controls. --------------------------------------------------------------------Part 4. Common Visual FoxPro questions Question 4-1: How do I hide the Visual FoxPro desktop when my application's .ex e file starts? Answer: Put the following line in the Config.fpw configuration file: SCREEN=OFF Note: If you do not need to provide the Config.fpw as a separate file-- that is, you will not need to be making any changes to it after building the .exe--you c an add the Config.fpw file to the project, making sure it is marked as included, and it will be built as part of the .exe. Visual FoxPro will not hide the deskt op unless there is a top-level form active. You can also programmatically hide t he desktop with the following command (assuming that a top-level form is already active): _VFP.Visible = .F. Question 4-2: How do I create a top-level form with a top-level menu? Answer: To create a top-level form, set the form's ShowWindow property to 2-As Top Level Form. To create a top-level menu, open the Menu Designer. From the Vie w menu, choose General Options, then select the Top-Level Form check box. To pla ce the top-level menu in the top-level form, you must place code in the Init (or other) event of the form. For example: DO <menu name.mpr> with THIS,.T.

To see various options for calling the top-level menu, read the header in the ge nerated .mpr file. Question 4-3: Some of the forms in the Solutions sample files do not display la bel or control captions correctly. Why not? Answer: The forms in the Solutions sample are designed to display correctly wit h the Windows default font setting (small fonts). If you use large fonts, some o f the forms will not be displayed correctly. To use small fonts, in the Control Panel double-click the Display icon; then in the Display dialog box, choose the Settings tab. In the Font Size drop-down list, choose Small Fonts. Question 4-4: Do I need to use the Join Source Control Project option on the Pr oject menu every time I open a Visual FoxPro project that is under source contro l? Answer: No, you do this only once. When you select Join Source Control Project, Visual FoxPro creates a copy of the existing project (.pjx) file on your local disk in the project's working directory. Visual FoxPro also creates a project (. pjm "project metafile")file list that it uses to manage the changes made by diff erent developers to the list of files in the project.) After you have joined a p roject, you can open the project as usual and Visual FoxPro will recognize that it is under source control. Question 4-5: When I add a file to a Visual FoxPro project under source control I get the following error message: "File <file name> could not be mapped to the SourceSafe project $/<project name>" The message is then followed by this message in the Source Control Results windo w: "SCC API error 'Operation not performed' occurred on file <file name>." The added file is not visible to other users sharing the project, even after I c hoose Update Project List. What am I doing wrong? Answer: When adding files to a Visual FoxPro project under source control, save them to the working directory in which the copy of the current project was crea ted. Question 4-6: I just added a file to a Visual FoxPro project under source contr ol and have added the file to source control as well, but it is not visible to o ther users sharing the project. What's wrong? Answer: After creating a new file or adding a file to a project, you must updat e the project list (.pjm) file so that the new or added file becomes visible to other users. From the Source Control submenu on the Project menu, choose Update Project List. Visual FoxPro then merges your local project file list with the on e stored centrally. Other users must then also do the same. When they do, Visual FoxPro merges the changes with their local project list (.pjm) file and rebuild s their local project (.pjx) file. Question 4-7: What is an offline view and what can I use it for? Answer: An offline view allows you to get a snapshot of a table and manipulate it without having to be connected to the host table. When you are finished with the table, you can connect to the host again and synchronize the view with the h

ost table. Using offline views, you can: * Replicate a subset of data from Visual FoxPro table or a remote data source. * Manipulate the replicated subset either interactively or through an application. * Share a change buffer table while off line. * Reconnect to the proper data source. * Batch update the local or remote table(s). These features can be very useful if you need to work with a small portion of da ta without being physically connected to its source -- for instance, when you ar e travelling or working offsite and you need to work with the most current data in a table. Question 4-8: What is the difference between the DataSource property and the Co ntrolSource property? RowSource property vs. RecordSource property? Answer: The DataSource property affects ODBC views stored in a database (.dbc). It contains a reference to the name of the data file to which ODBC is connectin g, and must point to a valid data source defined through the ODBC administrator. You can manipulate the DataSource property with the SQLSETPROP() function and v iew its settings with the SQLGETPROP() function. The ControlSource property is used to determine the source of data to which an o bject is bound; the table or view to which the object is bound can be of any typ e, including local Visual FoxPro tables. Objects that have a ControlSource prope rty include the CheckBox, Column, ComboBox, CommandGroup, EditBox, ListBox, OLE Bound Control, OptionButton, OptionGroup, Spinner, and TextBox controls. Several controls (ListBox and ComboBox) allow you to display more than one field and row at a time. In addition to the ControlSource property, these controls al so have a RowSource property for this. Data is still bound to a single field whi ch is why these controls have a ControlSource property. The Grid control is uniq ue in that it has a RecordSource property, but not a ControlSource property. Wit h Grids, data is bound to an entire set of records. Question 4-9: Why is my combo box displaying only one row of data? I dimension ed an array for the combo box and issued a SELECT - SQL command in the Init even t of my form to populate the array. Answer: You created an array in the form's Init event with no rows or with only one row. When the form is created, the Init event of the combo box occurs befor e the Init event of the form, and the combo box therefore contains only one row of information. To fix this, add the following line of code immediately after th e SELECT - SQL statement that creates the array in the form's Init event: THISFORM.ComboBox1.RowSource = THISFORM.ComboBox1.RowSource Question 4-10: s? How do I hide specific columns in a combo box and display other

Answer: The easiest way to hide specific columns in a combo box is with the Com bo Box Builder. Drag the columns to the desired width in the Layout tab of the C ombo Box Builder. To hide specific columns in a combo box programatically, set the ColumnWidth pro perty to 0 for the columns. In the following program code, Columns 1 and 2 are h idden, and Column 3 has a width of 100 pixels: THISFORM.ComboBox1.ColumnWidths = 0,0,100

Question 4-11: Using Visual FoxPro 6.0 running on Windows 95, I created an .exe file and used the Setup Wizard to make distribution disks. Now the application will not run on any Windows for Workgroups machines. Why is this? Answer: Visual FoxPro 6.0 is a 32-bit application and will create only 32-bit . exe files. Windows for Workgroups is a 16-bit operating system and can run only 16-bit applications. You need to have Windows 95 or Windows NT 4.0 or later to run your Visual FoxPro applications. Question 4-12: Can I customize the colors used to mark syntax in an edit window ? Answer: You can easily customize how your code looks by choosing Options from t he Tools menu and selecting the Syntax Coloring tab in the Option dialog box. T here you will find a variety of ways to customize the coloring of your code. If you would like to turn syntax coloring off completely, from the Edit menu cho ose Properties to display the Edit Properties dialog box. Then clear the Syntax Coloring check box. Question 4-13: Can I customize the comment marks used to comment out syntax in an edit window? Answer: Visual FoxPro does not directly support changing this option through the user interface, however, you can manually change this setting by adding a new s etting to the Windows Registry. First, open the Registry using RegEdit (type Reg Edit in the dialog prompted from Windows Start -> Run... menu). Next, locate the following Registry key. HKEY_CURRENT_USER\Software\Microsoft\VisualFoxPro\6.0\Options You should see a number of familiar settings in the viewing pane on right-side. These are the settings saved from the Visual FoxPro Options dialog. To add the n ew comment mark, select New -> String Value from the Edit menu and type in the f ollowing value: EditorCommentString Finally, double-click on this new Registry entry and add the new comment mark th at you want to use (by default, Visual FoxPro uses *!*). Make sure your entry st arts with an * since this denotes a comment in FoxPro code when compiled. Question 4-14: Can I customize the default number of items in a combo box's dro p-down list like the one used in the Code window or Property window? Answer: Visual FoxPro does not directly support changing this option through the user interface, however, you can manually change this setting by adding a new s etting to the Windows Registry. First, open the Registry using RegEdit (type Reg Edit in the dialog prompted from Windows Start -> Run... menu). Next, locate the following Registry key. HKEY_CURRENT_USER\Software\Microsoft\VisualFoxPro\6.0\Options You should see a number of familiar settings in the viewing pane on right-side. These are the settings saved from the Visual FoxPro Options dialog. To add the n ew DisplayCount, select New -> String Value from the Edit menu and type in the f ollowing value: DisplayCount

Finally, double-click on this new Registry entry and add the new number of lines to display (by default, Visual FoxPro 5.0 uses 7, and Visual FoxPro 6.0 uses 15 ). The DisplayCount property of user combo boxes still defaults to 7, to be backwar d compatible. Question 4-15: I am having problems using the Treeview and Listview ActiveX cont rols. For example, the images in the associated ImageList control are not being found. Why is this happening? Answer: The problem may be due to the version of Comctl32.ocx that you have inst alled. If you have a registered version of Comctl32.ocx or Mscomctl.ocx (new for Visual FoxPro 6.0) in your Windows\System directory that is dated after 8-21-96 , you cannot associate an ImageList control with the Treeview or Listview contro l via the Property Page. The solution is to manually place code such as the foll owing in the Init event of the control: ex. Treeview Init this.object.ImageList=thisform.imagelist1.object agelist object ex. Listview Init this.object.Icons=thisform.imagelist2.object agelist object this.object.SmallIcons=thisform.imagelist3.object agelist object && imagelist1=im

&& imagelist2=im && imagelist3=im

The following also applies to using a registered Comctl32.ocx file dated after 8 -21-96: If you have a form (.scx) or class (.vcx) container that has a TreeView or ListV iew control using an ImageList control, and the form or class was saved using a Comctl32.ocx dated 8-21-96 (the version that ships with Visual FoxPro 5.0), then that form or class will run under any older or the newest version of Comctl32.o cx, so forward compatibility is fully retained. If you x, and 32.ocx rsions create and/or save a form or class that uses a control within Comctl32.oc your Comctl32.ocx is dated after 8-21-96, then the same version of Comctl or later will be required to modify and/or run that form or class. New ve of Comctl32.ocx are forward compatible only, not backward compatible.

Question 4-16: I have a Treeview or Listview ActiveX control that is slow in loa ding items. Is there a way to improve performance? Answer: When populating a TreeView or ListView control, add the following logic: treeview.Visible=.F. treeview.Top=treeview.Top+9999 <add your code here to populate treeview here> treeview.Top=treeview.Top-9999 treeview.Visible=.T. Usually this doubles the load performance, mainly because the control doesn't tr y to refresh its own user interface for every addition of a node. Question 4-17: I am having problems running the second FoxISAPI sample (FOXIS.EM PLOYEE) from my web browser even though I can instantiate the server from within Visual FoxPro. Why?

Answer: Often when there are issues such as this where the server runs fine in V isual FoxPro but not in the browser, you have a configuration problem. It's like ly that you have not provided proper access rights for your web server which can be resolved by running the Dcomcnfg.exe file and changing these settings. For m ore information, search for "FoxISAPI: An OLE Server Sample" in Help.

S-ar putea să vă placă și