简体   繁体   中英

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. 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).

When I run my program within the VFP development environment, this works fine. 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.

I have never used windows in VFP (as my programs are always just batch processes), so do not know what to do.

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.

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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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