The V C++ GUI Framework:vReplyDialog

From EDM2
Jump to: navigation, search

A utility class to get a text reply from the user.


[vquickr.htm#vReplyDialog <v/vreply.h>]
Class name:
vModalDialog ->vReplyDialog


This simple utility class can be used to obtain a text reply from the user. The utility displays a message, and then waits for the user to enter a reply into the reply field. The user completes the operation by pressing OK or Cancel.

New Methods

vReplyDialog(vBaseWindow* win)

vReplyDialog(vApp* app)

The vReplyDialog constructor requires a pointer to a vBaseWindow, which includes all V windows and dialogs, or a pointer to the vApp object. You will usually pass the this to the constructor.

int Reply(const char* prompt, char* reply, const int maxLen, char* dflt = "")

You provide a prompt for the user. The text the user enters will be returned to the buffer reply of maximum length maxLen. Reply will return the value M_OK or M_Cancel. Use dflt to provide a default reply.


The following is a simple example of using vReplyDialog.


    #include <v/vreply.h>
    vReplyDialog rp(this);      // instantiate
    char r[100];                // a buffer for reply

    (void)rp.Reply("Please enter some text.",r,99);

    vNoticeDialog note(this);   // instantiate a notice

    if (*r)
        (void)note.Notice("No text input.");