Jump to content

VYNReplyDialog: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:


==Synopsis==
==Synopsis==
 
;Header: <tt><v/vynreply.h></tt>
; '''Header:'''
;Class name: vYNReplyDialog
: <tt>[vquickr.htm#vYNReplyDialog <v/vynreply.h>]</tt>
;Hierarchy: [[vModalDialog]] ->vYNReplyDialog
; '''Class name:'''
: vYNReplyDialog
; '''Hierarchy:'''
: [vmodald.htm vModalDialog] ->vYNReplyDialog


==Description==
==Description==
This simple utility class can be used to display a simple message to the user. The utility displays the message, and then waits for the user to enter to press Yes, No, or Cancel.
This simple utility class can be used to display a simple message to the user. The utility displays the message, and then waits for the user to enter to press Yes, No, or Cancel.


==New Methods==
==New Methods==
 
;vYNReplyDialog(vBaseWindow* win)
====vYNReplyDialog(vBaseWindow* win)====
;vYNReplyDialog(vApp* app):The <tt>vYNReplyDialog</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 AskYN(const char* prompt):You provide a <tt>prompt</tt> for the user. The user will then press the Yes, No, or Cancel buttons. <tt>AskYN</tt> returns a 1 if the user selected Yes, a 0 if they selected No, and a -1 if they selected Cancel.
====vYNReplyDialog(vApp* app)====
 
The <tt>vYNReplyDialog</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 AskYN(const char* prompt)====
 
You provide a <tt>prompt</tt> for the user. The user will then press the Yes, No, or Cancel buttons. <tt>AskYN</tt> returns a 1 if the user selected Yes, a 0 if they selected No, and a -1 if they selected Cancel.


===Example===
===Example===
The following is a simple example of using <tt>vYNReplyDialog</tt>.
The following is a simple example of using <tt>vYNReplyDialog</tt>.


[[Image:v-gui-ynreply.gif]]<br /><font size="-2"> </font>
[[Image:v-gui-ynreply.gif]]


     #include <v/vynreply.h>
     #include <v/vynreply.h>
     ...
     ...
Line 41: Line 27:
       exit(0);
       exit(0);


[[Category:Tools Articles]]
[[Category:V C++ GUI Framework]]

Latest revision as of 22:46, 9 April 2020

A utility class to display a message, and get a Yes or No answer.

Synopsis

Header
<v/vynreply.h>
Class name
vYNReplyDialog
Hierarchy
vModalDialog ->vYNReplyDialog

Description

This simple utility class can be used to display a simple message to the user. The utility displays the message, and then waits for the user to enter to press Yes, No, or Cancel.

New Methods

vYNReplyDialog(vBaseWindow* win)
vYNReplyDialog(vApp* app)
The vYNReplyDialog 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 AskYN(const char* prompt)
You provide a prompt for the user. The user will then press the Yes, No, or Cancel buttons. AskYN returns a 1 if the user selected Yes, a 0 if they selected No, and a -1 if they selected Cancel.

Example

The following is a simple example of using vYNReplyDialog.

    #include <v/vynreply.h>
    ...
    vYNReplyDialog ynd(this);   // instantiate a notice

    int ans = ynd.AskYN("Exit. Are you sure?);
    if (ans == 1)
      exit(0);