VReplyDialog: Difference between revisions
Appearance
Created page with "A utility class to get a text reply from the user. ==Synopsis== ; '''Header:''' : <tt>[vquickr.htm#vReplyDialog <v/vreply.h>]</tt> ; '''Class name:''' : vReplyDialog ; '''Hiera..." |
(No difference)
|
Revision as of 18:52, 14 November 2012
A utility class to get a text reply from the user.
Synopsis
- Header:
- [vquickr.htm#vReplyDialog <v/vreply.h>]
- Class name:
- vReplyDialog
- Hierarchy:
- vModalDialog ->vReplyDialog
Description
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.
Example
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(r);
else
(void)note.Notice("No text input.");