os::InputBox Class Reference
[The Syllable Graphical User Interface API]

Simple InputBox class. More...

Inheritance diagram for os::InputBox:

os::Window os::Looper os::Handler List of all members.

Public Member Functions

 InputBox (os::Messenger *pcTarget=NULL, const os::String &cTitle="InputBox", const os::String &cLabel="Please enter your value here:", const os::String &cText="", const os::String &cOkBut="_Okay", const os::String &cCancelBut="_Cancel", bool bNumeric=false, uint32 nFlags=os::WND_MODAL|os::WND_NOT_RESIZABLE|os::WND_NO_DEPTH_BUT|os::WND_NO_ZOOM_BUT)
 InputBox constructor.
 ~InputBox ()
os::Variant GetValue () const
 
Description:
Returns the value of the InputBox(as a Variant).

void SetNumeric (bool)
 
Description:
SetNumeric tells the os::InputBox whether or not it is for Numeric input only.

bool GetNumeric () const
 
Description:
Returns whether or not the InputBox is numeric.

void SetLabelText (const os::String &)
 
Description:
SetLabelText sets the text that is displayed in the InputBox's StringView.

os::String GetLabelText () const
 
Description:
Returns the label text(i.e., the text that is shown by the os::StringView).

void SetInputText (const os::String &)
 
Description:
SetInputText sets the text that is displayed in the InputBox's TextView.

os::String GetInputText () const
 
Description:
Returns the input text.

void SetOkButtonText (const os::String &)
 
Description:
SetOkButtonText sets the text that is displayed on the okay button.

os::String GetOkButtonText () const
 
Description:
Returns the ok button text(i.e., the text that is shown on the Ok Button).

void SetCancelButtonText (const os::String &)
 
Description:
SetCancelButtonText sets the text that is displayed on the cancel button.

os::String GetCancelButtonText () const
 
Description:
Returns the cancel button text(i.e., the text that is shown on the CancelButton).

void HandleMessage (os::Message *pcMessage)
 Handle a message targeted at this handler.
bool OkToQuit ()
 Check if it is ok to break the loop.

Classes

class  Private

Detailed Description

Description:
An InputBox is a way to get user input from a user. Use an InputBox when you need some data from a user(e.g., a date, a number, a string, and anything else).
There are two ways you can use InputBox:

The first way is by catching the os::Message code(M_BOX_REQUESTED) like

YourHandler::HandleMessage(os::Message* pcMessage) { switch (pcMessage->GetCode()) { case M_BOX_REQUESTED: { os::Variant cVariant = inputBox->GetValue();

//do something with it

break; } } }

And the second way starts out like the first, except that when the message is passed to HandleMessage(), it passes the value along with it. So You could do:

YourHandler::HandleMessage(os::Message* pcMessage) { switch (pcMessage->GetCode()) { case M_BOX_REQUESTED: { os::Variant cVariant; pcMessage->GetVariant("value",&cVariant);

//do something with it

break; } } }

See also:
os::Window, os::String, os::Messenger, os::Message, os::Variant, os::Handler
Author:
Rick Caudill([email protected])


Constructor & Destructor Documentation

InputBox::InputBox ( os::Messenger pcTarget = NULL,
const os::String cTitle = "InputBox",
const os::String cLabel = "Please enter your value here:",
const os::String cText = "",
const os::String cOkBut = "_Okay",
const os::String cCancelBut = "_Cancel",
bool  bNumeric = false,
uint32  nFlags = os::WND_MODAL | os::WND_NOT_RESIZABLE | os::WND_NO_DEPTH_BUT | os::WND_NO_ZOOM_BUT 
)

Description:
InputBox constructor.
Parameters:
pcTarget - os::Messeneger pointer to the parent(used to send messages).
cTitle - The title of the window
cLabel - The label displaying a message to the user
cText - The default input text
cOkBut - The okay button text
cCancelBut - The cancel button text
bNumeric - Whether or not the dialog is for numbers only
nFlags - The flags for the window
Author:
Rick Caudill ([email protected])

InputBox::~InputBox (  ) 


Member Function Documentation

os::Variant InputBox::GetValue ( void   )  const

Essentially all we have is a TextView, so you would think that we would want to return this as an os::String, right? No, and the reasoning behind returning it as an os::Vairant is so you can do operations like: GetValue().AsFloat(), GetValue().AsString()

Author:
Rick Caudill ([email protected])

void InputBox::SetNumeric ( bool  bNumeric  ) 

Setting this to true will mean that only numbers(0-9), one decimal point(.), and one e(e) can be punched in.

Parameters:
bNumeric - Whether or not the dialog is for numbers only
Author:
Rick Caudill ([email protected])

bool InputBox::GetNumeric (  )  const

Author:
Rick Caudill ([email protected])

void InputBox::SetLabelText ( const os::String cText  ) 

Parameters:
cText - the new text to set the label to
Author:
Rick Caudill ([email protected])

os::String InputBox::GetLabelText (  )  const

Author:
Rick Caudill ([email protected])

void InputBox::SetInputText ( const os::String cText  ) 

Parameters:
cText - the new text to set the TextView to
Author:
Rick Caudill ([email protected])

os::String InputBox::GetInputText (  )  const

This can be used in lieu of GetValue() if you just want to capture the text inputed by the user.

Author:
Rick Caudill ([email protected])

void InputBox::SetOkButtonText ( const os::String cText  ) 

Parameters:
cText - the new text to set the okay button to
Author:
Rick Caudill ([email protected])

os::String InputBox::GetOkButtonText (  )  const

Author:
Rick Caudill ([email protected])

void InputBox::SetCancelButtonText ( const os::String cText  ) 

Parameters:
cText - the new text to set the cancel button to
Author:
Rick Caudill ([email protected])

os::String InputBox::GetCancelButtonText (  )  const

Author:
Rick Caudill ([email protected])

void InputBox::HandleMessage ( os::Message pcMessage  )  [virtual]

Description:
Overload this member to dispatch messages sendt to this handler. When a looper receives a message for one of it's handlers it will call the taget handlers HandleMessage() to allow the handler to dispatch the message.
The message passed in pcMessage is also available through os::Looper::GetCurrentMessage() and os::Looper::DetachCurrentMessage() until this member returns. This is normally not very usefull for HandleMessage() itself but it can be convinient for other members called from HandleMessage() in case they need data from the message that was not passed on from HandleMessage().
The looper will be locked when this member is called. The default implementation of this member will pass the message on to the next handler if one was set with SetNextHandler().
Note:
Never do any lenthy operations in any hook members that are called from the looper thread if the looper is involved with the GUI (for example if the looper is a os::Window). The looper will not be able to dispatch messages until the hook returns so spending a long time in this members will make the GUI feel unresponsive.
Parameters:
pcMessage The message that should be handled. This message will be deleted by the looper when HandleMessage() returns unless you detach it with os::Looper::DetachCurrentMessage(),
See also:
os::Looper::DispatchMessage(), os::Looper::DetachCurrentMessage()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::Handler.

bool InputBox::OkToQuit ( void   )  [virtual]

Description:
You can overload this function to affect how the looper will react to M_QUIT messages. When an M_QUIT message arrive the looper will call this function to figure out what to do. If it returns false the message is ignored. If it returns true the loop is terminated, the looper object deleted and the looper thread will exit.
Returns:
true if it is ok to terminate the looper, false otherwise.
See also:
Quit(), PostMessage()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::Looper.


Generated on Sat May 9 22:51:33 2009 for Syllable higlevel API by  doxygen 1.5.1