Jump to content

KrWinComm

From EDM2
Revision as of 16:18, 5 April 2015 by Martini (talk | contribs) (Created page with "==Description== '''#include "krwc.hpp"''' This class, in combination with some operators, acts similar to an istream object. It queries data from the user by presenting him ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

#include "krwc.hpp"

This class, in combination with some operators, acts similar to an istream object. It queries data from the user by presenting him a dialog box.

Please note that this class does not really inherit from istream, so that not all types which can be input via an istream can also immediately be input via a KrWinComm object. It is possible, however, to provide that support for arbitrary objects in a convenient way. Have a look at the user's guide and the demo programs dialog3 and demo to learn details.

Derivation

KrWinComm inherits from IBase.

Constructors

You can construct and destruct objects of this class.

Overload 1

public: 
KrWinComm (const IString & aTitle = "Dialog");

The constructor initializes essential object data, but does not create the dialog window. The window is created when the first input is queried from the KrWinComm object. The dialog title can be changed at a later time using setTitle.

Public Functions

Appearance

setFont

Use this function to change the default font used in the dialog window.

public: 
void setFont (const IFont & aFont); 

setTitle

Use this function to change the dialog window's title.

public: 
void setTitle (const IString & aTitle); 

Constructors

KrWinComm

You can construct and destruct objects of this class.

Overload 1

public: 
KrWinComm (const IString & aTitle = "Dialog");

The constructor initializes essential object data, but does not create the dialog window. The window is created when the first input is queried from the KrWinComm object. The dialog title can be changed at a later time using setTitle.

~KrWinComm

public: 
~KrWinComm (); 

Diagnostics

ok

Use this function to find out whether the last dialog has been aborted.

public: 
Boolean ok (); 

This function returns true if the user completed the dialog and pressed the OK button, and false if he aborted it.

Display Dialog

run

This function displays the dialog and waits for the user input.

public: 
Boolean run (); 

The function returns true if the user completed the dialog and pressed the OK button, and false if he aborted it.

Note: It is recommended to use the display modifier instead of this function.

Input

addEntryField

This function prepares the KrWinComm object to input variables of the corresponding type.

Overload 1

public: 
void addEntryField (IString & s); 


Overload 2

public: 
void addEntryField (double & d); 

Overload 3

public: 
void addEntryField (unsigned long & l); 

Overload 4

public: 
void addEntryField (signed long & l); 

Overload 5

public: 
void addEntryField (KrBitfield & b); 


Overload 6

public: 
void addEntryField (KrChoice & c); 


Overload 7

public: 
void addEntryField (KrUserDataField & f); 


Overload 8

public: 
void addEntryField (KrUserDataField * f); 

The function returns true if the user completed the dialog and pressed the OK button, and false if he aborted it.

Note: Do not use any of these functions. Use the corresponding operator >> instead.


Output

addToNextPrompt

setNextPrompt

Operators

Manipulators