简体   繁体   English

如何在VFP 9中创建滚动窗口

[英]How to create a scrolling window in VFP 9

In VFP9 I have an application which carries out a pre-defined sequence of operations, then ends. 在VFP9中,我有一个应用程序,它执行预定的操作序列,然后结束。 While it runs I need to report progress to the user (such as "reading transaction file", "123 records read", "file abc.txt not found", etc, etc, to the user). 在运行时,我需要向用户报告进度(例如向用户报告“正在读取事务文件”,“已读取123条记录”,“未找到文件abc.txt”等)。

When I run my program within the VFP development environment, this works fine. 当我在VFP开发环境中运行程序时,这可以正常工作。 I want to create the equivalent of a VB console window, for standalone use of my program as an .EXE, to which I can display the messages, then scroll them up when the window is full and write to the bottom of the screen. 我想创建一个等效于VB控制台窗口的程序,以便将程序作为.EXE单独使用,可以在其中显示消息,然后在窗口满时向上滚动消息并写入屏幕底部。

I have never used windows in VFP (as my programs are always just batch processes), so do not know what to do. 我从未在VFP中使用过Windows(因为我的程序始终只是批处理),所以不知道该怎么办。

Please can you give me some sample code for this or tell me where to find it. 请为我提供一些示例代码,或告诉我在哪里可以找到它。

The way I usually handle this kind of requirement is to create a form, drop an editbox on it, and size the editbox to match the form. 我通常处理这种要求的方式是创建一个表单,在其上放置一个编辑框,然后调整该编辑框的大小以匹配该表单。 If the user can resize the form, then I'll set Anchor for the editbox to keep it sized to the form. 如果用户可以调整表单的大小,那么我将为编辑框设置Anchor,以使其保持与表单相同的大小。

Then, each time I need to add information, I add it to the editbox's Value. 然后,每次需要添加信息时,都将其添加到编辑框的“值”中。 I can keep the bottom of the listing in view by ensuring that SelStart for the editbox is set to the end of the current text. 通过确保将editbox的SelStart设置为当前文本的末尾,我可以保持列表底部的位置。 Typically, I'll do all this with a custom method with code like: 通常,我将使用带有以下代码的自定义方法来完成所有这些操作:

* Assuming this is a method of the editbox:
LPARAMETERS cNewMessage

This.Value = This.Value + CHR(13) + CHR(10) + m.cNewMessage
This.SelStart = LEN(This.Value)

Tamar 添马舰

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM