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..." |
mNo edit summary |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
==Synopsis== | ==Synopsis== | ||
;Header: <tt>[vquickr.htm#vReplyDialog <v/vreply.h>]</tt> | |||
; | ;Class name: vReplyDialog | ||
: <tt>[vquickr.htm#vReplyDialog <v/vreply.h>]</tt> | ;Hierarchy: vModalDialog ->vReplyDialog | ||
; | |||
: vReplyDialog | |||
; | |||
: vModalDialog ->vReplyDialog | |||
==Description== | ==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. | 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== | ==New Methods== | ||
;vReplyDialog(vBaseWindow* win) | |||
;vReplyDialog(vApp* app):The <tt>vReplyDialog</tt> constructor requires a pointer to a <tt>vBaseWindow</tt>, which includes all '''''V''''' windows and dialogs, or a pointer to the <tt>vApp</tt> object. You will usually pass the <tt>this</tt> to the constructor. | |||
;int Reply(const char* prompt, char* reply, const int maxLen, char* dflt = ""):You provide a <tt>prompt</tt> for the user. The text the user enters will be returned to the buffer <tt>reply</tt> of maximum length <tt>maxLen</tt>. <tt>Reply</tt> will return the value <tt>M_OK</tt> or <tt>M_Cancel</tt>. Use dflt to provide a default reply. | |||
The <tt>vReplyDialog</tt> constructor requires a pointer to a <tt>vBaseWindow</tt>, which includes all '''''V''''' windows and dialogs, or a pointer to the <tt>vApp</tt> object. You will usually pass the <tt>this</tt> to the constructor. | |||
You provide a <tt>prompt</tt> for the user. The text the user enters will be returned to the buffer <tt>reply</tt> of maximum length <tt>maxLen</tt>. <tt>Reply</tt> will return the value <tt>M_OK</tt> or <tt>M_Cancel</tt>. Use dflt to provide a default reply. | |||
===Example=== | ===Example=== | ||
The following is a simple example of using <tt>vReplyDialog</tt>. | The following is a simple example of using <tt>vReplyDialog</tt>. | ||
[[Image:reply.gif]] | [[Image:v-gui-reply.gif]] | ||
#include <v/vreply.h> | #include <v/vreply.h> | ||
... | ... | ||
Line 47: | Line 33: | ||
(void)note.Notice("No text input."); | (void)note.Notice("No text input."); | ||
[[Category: | [[Category:V C++ GUI Framework]] |
Latest revision as of 22:39, 9 April 2020
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.");