|
Hidden Secrets of the VFP IDE, Part 2 Cathy Pountney FoxPro has always had several different ways to do the same thing. How many times have you looked over the shoulder of another developer and said, "Hey! How did you do that?" In this article Cathy Pountney uncovers many ways to work within the IDE, especially those that aren't so obvious or aren't documented. You'll learn several different ways to improve your productivity. Even experienced developers are bound to learn something new. This is the second of two articles where I've been exposing several unknown secrets of the VFP IDE. In the first part, I discussed various designers, a few controls, the Property Sheet, the Document View, and the Find Dialog. Then I revealed some secrets of IntelliSense as well as several tools and utilities included with Visual FoxPro. In this article, I'll reveal secrets of the Command window, several commands, and wrap up with a potpourri of hidden secrets. Command window and commands The Command window is another place we spend a lot of our day. Here are some tips that can be used in the Command window as well as some lesser-known secrets about some of VFP's commands. Command window Many people already know that you can highlight a line of code in the Command window, right-click, and choose Execute Selection to execute the highlighted code. But did you know that you can highlight multiple lines of code and execute them at once? However, you have to realize how this works or you might not get the expected results. When multiple lines of code are executed, a temporary program is created and then run. This means that variables can go out of scope after the chunk of code has been run. This is really more of a "hidden gotcha" than a "hidden secret"! Another thing you can do in the Command window is use the semicolon (;) as a continuation character just as you do in code. This is great when you're copying code from a program or when you're creating a giant SELECT statement that you want to be able to wrap. _CLIPTEXT The first extra is a system variable called _CLIPTEXT. This contains the contents of the VFP clipboard. You can use it to set other information based on what's in the clipboard, and you can use it to define what's in the clipboard. It's a two-way variable that you can take advantage of at design time and even at runtime within your application. To demonstrate, highlight a line of code in the Command window and press Ctrl+C to save it to the clipboard. Now enter ? _CLIPTEXT in the Command window and you'll see that the line of code you highlighted is printed on the screen. Another example is to run the following code to create a program: The preceding code fills the clipboard with two lines of code, creates a program file, and then pastes the contents of the clipboard into the newly created program. _VFP.DataToClip() The second extra that VFP has to help us with cut-and-paste functions is the _VFP.DataToClip() function. This function takes data from a table or cursor and puts it into the clipboard. From there, you can paste it anywhere else, including Microsoft Excel. The third parameter defines the format of the data. If you use a 1 in the third parameter, the data uses spaces to separate each field. However, if you use a 3 in the third column, tabs are used to separate each field, which makes it perfect for inserting into Excel or other applications. Printing the clipboard Another little-known feature in VFP is the fact that you can print what's in the clipboard. This is great when you want to print a chunk of code from a program, but not the entire program. Highlight the text you want to print and select File | Print from the main VFP menu to invoke the Print dialog (you can also use Ctrl+P to invoke the same dialog). From the Print dialog, select the Options button to display the Print Options dialog. By default the Print What — Type combo box is filled in with the current program. However, you can select Clipboard, select OK, and then go back to the Print dialog to finish selecting your printing options. BROWSE keystrokes When using the BROWSE command, there are several keystrokes you can use to perform special operations, as shown in Table 1. Table 1. Keystrokes with the BROWSE command.
What's in a NAME? The NAME clause can be very helpful for passing data around. The SCATTER, GATHER, and INSERT INTO commands all honor the NAME clause. This makes these commands much more powerful than in earlier days when you were used to SCATTERing into MEMVARs. Now that you can SCATTER to a NAME, you can pass the data to another object as a parameter. The following code shows an example of how to do this: Another great example of using the NAME clause is with the BROWSE command. In the Command window, enter the following: Now in the Command window, enter the string "oBrowse." (don't forget the trailing period) and you'll see IntelliSense kick in as soon as you type the period. This is great–the browse window is now an object you can manipulate. Start picking some properties, such as fontbold or rowheight, from IntelliSense and you can manipulate the browse window right from the Command window. Implicit TRANSFORM() In VFP 8, a few commands have implemented an implicit TRANSFORM() feature. This means that you can use data types that aren't character, and the command will TRANSFORM it automatically for you. If the item being transformed is an object, the text "(Object)" is used. Try the following commands and you'll be pleasantly surprised that they don't throw an error! Potpourri Here are a few more hidden secrets that are scattered throughout Visual FoxPro. Shifty tricks Using the Shift key before selecting a menu option can change the options on the menu. For example, pressing Shift and selecting the File menu changes the Close option to Close All. Using Shift along with the Window menu changes Hide to Hide All. Normally, the Format | Font option changes the font in the Command window. However, using the Shift key with the Format menu changes the Font option to Screen Font, which changes the font of the VFP screen. Another feature that's been around for years and years in FoxPro and VFP is the Outshow feature. Pressing Ctrl+Alt+Shift hides all the windows except the one accepting output. They stay hidden as long as you continue pressing the key combination. As soon as you let go, all the hidden windows appear again. This is extremely useful when you display something from the Command window with the question mark (?) character and the results end up getting shown behind a bunch of other windows. Copy a class At first, it appears that there isn't a way to copy an existing class in VFP. You can subclass it–but there doesn't seem to be any way to copy a class. Well, with the use of the Project Manager it can be accomplished quite quickly with the following steps: 1. Drag the source class from one library to another. 2. Rename the class in the new library. 3. Drag the newly named class back to the original library. 4. Delete the class from the temp library. Of course, it would be nice if there was a copy button on the right-click menu or somewhere else. But heck, we can't have everything! Drag and drop In VFP 8, the Project Manager was improved by allowing you to add multiple files at once. Prior to this version, you could only add one file at a time. However, you can use drag and drop to add multiple files, and this feature has been around for quite a while. Open the Project Manager and then open Explorer. Select some files in Explorer and drag them to the Project Manager. An added benefit is that the Project Manager is smart enough to figure out what tab to put each of the different files on based on their file extensions. _VFP.SetVar() This little-known function can be used to set variables in situations where you can't execute a command but you can call a function. A perfect example of when to use this is in the Report Designer. I use it all the time in the OnEntry and OnExit expressions of the various bands. For example, in the OnExit expression of a Group Footer, you can use _VFP.SetVar('rnRecordCount', 0) to clear the value of the rnRecordCount variable. Or you can use _VFP.SetVar('rnCountDataGroups', rnCountDataGroups+1) to increase a variable that tracks the number of data groups processed. Wildcards Some commands accept wildcards, and although this can be great to work with, it can also be dangerous. There's not much harm in entering MODI COMM MyProg*. All it's going to do is open up all the programs that are named starting with MyProg. However, issue DELETE FILE MyProg*.prg and "Danger! Danger! Danger!" flashes across my mind. Be careful in how you use wildcards! Just for fun Whew! This has been an article full of information. By now your brain is probably getting fuzzy, so I'm going to end with a few fun things. Filer Years ago, Filer was what most FoxPro developers used to search and find files. After VFP 3.0, this disappeared and many developers screamed. Well, the Fox Team has listened and decided to bring back a little nostalgia. Enter the following in the Command window to see an example of how it runs: Search through the VFP Help file and read up on the new Filer, because this one is object-oriented and you can interact with it and implement it in your own applications. I guess you could call this FilerX! Puzzle Here's another long-lost feature of FoxPro that has been brought back in VFP 8. Enter the following in the Command window. However, be forewarned that this may severely reduce your productivity at work! Error-free programs Did you know that writing error-free programs is a cinch with VFP? Just enter the following line of code in your startup program and you're all set. Of course, this doesn't mean that your program is bug free. It only means that you won't get any error messages! Love your work! I know you love VFP so much that you never want to leave it. Well, no problem. When you start up VFP, enter the following line of code: No matter how hard you try, you can't get out of VFP now. This is great–you can sit in VFP 24/7 and never have to leave! Okay, okay, I guess this isn't such a great idea. I guess you'd better undo the damage with the following code: Work smarter, not harder This pair of articles has been crammed full of information. My goal was to expose you to as many cool features as possible and to give you some "ah ha" moments. Some of it may not have been new to you, but for the parts that were new, they could be huge time-savers for you in the future. As I always say, "Work smarter, not harder!" To find out more about thisjournalname and Pinnacle Publishing, visit their Web site at http://www.pinpub.com/ Note: This is not a Microsoft Corporation Web site. Microsoft is not responsible for its content. This article is reproduced from the March 2004 issue of thisjournalname. Copyright 2004, by Pinnacle Publishing, Inc., unless otherwise noted. All rights are reserved. thisjournalname is an independently produced publication of Pinnacle Publishing, Inc. No part of this article may be used or reproduced in any fashion (except in brief quotations used in critical articles and reviews) without prior consent of Pinnacle Publishing, Inc. To contact Pinnacle Publishing, Inc., please call 1-800-788-1900. |
相关推荐
【Telephony】APN配置及加载流程&项目实践(AOSP)
学习APN关键是学会明白apns-conf.xml文件各个参数的意思,然后熟悉TelephonyProvider是如何读取文件创建数据库的,譬如数据库表的约束、文件的读写顺序等,还有读取后的ApnSetting的二次定制以及显示(例如屏蔽xcap等)。虽然一般在项目中APN的需求很简单,就是按照客户提供的APN参数添加上配置,或者在显示屏蔽一些参数,但是项目维护的过程中APN的问题也是比较多的。
VFP 数据复制入粘贴板 _vfp.DataToClip() _cliptext
1、把网格数据源表的数据复制到粘贴板 _vfp.DataToClip(logrid.RecordSource,,3) 2、把文本复制至剪贴板 _cliptext= “要复制到剪贴板字符串”
Ubuntu运行vmware时报错Vmware Unable to install all modules!Use shipped Linux kernel AIO access library解决。
Ubuntu运行vmware时报错Vmware Unable to install all modules! vmware --version 提示下面内容: [AppLoader] Use shipped Linux kernel AIO access library. An up-to-date "libaio" or "libaio1" package from your system is preferred. VMware Workstation 16.1.2 build-17966106
VFP grid 表格数据复制入粘贴板 _vfp.DataToClip() _cliptext
直接上代码 **************************************************** * * 当是网格时,复制网格的数据进粘贴板 * 2020-3-28 修改 Set Textmerge On Suspend Do Case This.linedit Return Case Empty(This.RecordSource) Return .F. C...
双有源桥DC-DC变换器:原理、软开关与移相控制深度解析
隔离型DC-DC变换器是电力电子系统的核心部件,通过高频变压器实现电气隔离与电压匹配,保障系统安全与灵活适配。其工作原理基于功率半导体器件的开关动作,通过调制策略控制能量传输。该技术的核心价值在于实现高效、高功率密度的电能转换,并支持双向能量流动,这对于提升系统整体能效和运行灵活性至关重要。在新能源储能、电动汽车V2G及数据中心供电等场景中,双向能量流成为刚性需求,推动了如双有源桥等先进拓扑的应用。本文聚焦于双有源桥这一实现高效双向隔离变换的“明星”方案,深入剖析其利用移相控制实现软开关的机理。通过分析谐振
最优控制 (Optimal Control) 算法详解及案例分析
最优控制是一种通过优化控制输入,使系统在满足约束条件的情况下达到最优性能的控制方法。其目标是最小化或最大化一个性能指标。
Hidden Secrets of the VFP IDE, Part 1
Hidden Secrets of the VFP IDE, Part 1 Cathy Pountney FoxPro has always had several different ways to do the same thing. How many times have you looked over the shoulder of another developer and
地平线旭日X3开发板--使用Opencv显示CSI摄像头例程
但是从libsrcampy获取的摄像头图像格式是NV12,无法直接在opencv上显示或者处理,调试过程发现旭日派无法直接用opencv的VideoCapture()调用CSI摄像头,需要使用opencv来做开发的小伙伴可以做个参考,效果如下图所示。需要使用libsrcampy库来获取CSI摄像头图像,为了能够使用opencv的API来处理图像,需要增加NV12转化成bgr像素格式的函数。opencv显示图像.png。
VFP全面控制EXCEL
VFP和Excel都可以用来进行处理数据库表格,如果巧妙地将二者的优点结合起来,将会大大方便我们的工作。比如我们可以利用VFP进行处理数据,而利用Excel的预览打印功能进行报表打印。这就需要我们在VFP中直接来控制Excel。下面就在开发VFP应用项目时对Excel的控制作一下介绍:*!* 1.创建Excel对象oExcel=Createobject("Excel.application"
用 Docker 一键部署 SillyTavern酒馆 mac/windows/linux通用教程,我再也不手动折腾了!
本文介绍了如何使用 Docker 一键部署 SillyTavern 项目,适用于 Mac、Windows 和 Linux 系统。SillyTavern 是一个本地部署的大语言模型聊天界面,支持多种插件和扩展。文章详细说明了安装 Docker、拉取项目、启动容器、配置白名单、启用插件等步骤,并提供了常见问题的解决方法。通过 Docker 部署,用户可以避免繁琐的手动配置,快速搭建和运行 SillyTavern,适合希望简化部署流程的用户。
Thinkpad可以安装Win11吗?Thinkpad升级Win11教程
win11正式版推出之后,不少用户也想要体验一把新系统,但是不知道thinkpad是否支持win11,其实基本上现在在售的都是可以升级win11的。2、如果大家使用的是老款的ThinkPad,那么可以通过软件来检测自己是否支持win11。【电脑健康状况检查下载】答:在售的ThinkPad都是可以支持win11的,但是部分旧版本不支持。2、这时候想要升级win11的话,就可以通过镜像系统的方式来跳过系统检测。3、如果使用上面的软件检测可以支持win11,那么只要进入“设置”
VFP开源项目之:Visual FoxPro IntelliSense增强工具FoxcodePlus
项目经理: Rodrigo Bruscain 下载:http://vfpx.codeplex.com/downloads/get/507407 FoxcodePlus项目旨在为Visual FoxPro IDE环境带来类似Visual Studio的新IntelliSense功能,包括: 针对函数、命令等的递增IntelliSense; 书写时刻的变量; 书写时刻访问变量
jre9下载 jdk9
(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】
5527




被折叠的 条评论
为什么被折叠?



