Inheritance diagram for os::InputBox:
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 |
| |
void | SetNumeric (bool) |
| |
bool | GetNumeric () const |
| |
void | SetLabelText (const os::String &) |
| |
os::String | GetLabelText () const |
| |
void | SetInputText (const os::String &) |
| |
os::String | GetInputText () const |
| |
void | SetOkButtonText (const os::String &) |
| |
os::String | GetOkButtonText () const |
| |
void | SetCancelButtonText (const os::String &) |
| |
os::String | GetCancelButtonText () const |
| |
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 |
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; } } }
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 | |||
) |
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 |
InputBox::~InputBox | ( | ) |
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()
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.
bNumeric | - Whether or not the dialog is for numbers only |
bool InputBox::GetNumeric | ( | ) | const |
void InputBox::SetLabelText | ( | const os::String & | cText | ) |
cText | - the new text to set the label to |
os::String InputBox::GetLabelText | ( | ) | const |
void InputBox::SetInputText | ( | const os::String & | cText | ) |
cText | - the new text to set the TextView to |
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.
void InputBox::SetOkButtonText | ( | const os::String & | cText | ) |
cText | - the new text to set the okay button to |
os::String InputBox::GetOkButtonText | ( | ) | const |
void InputBox::SetCancelButtonText | ( | const os::String & | cText | ) |
cText | - the new text to set the cancel button to |
os::String InputBox::GetCancelButtonText | ( | ) | const |
void InputBox::HandleMessage | ( | os::Message * | pcMessage | ) | [virtual] |
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(). 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(), |
Reimplemented from os::Handler.
bool InputBox::OkToQuit | ( | void | ) | [virtual] |
Reimplemented from os::Looper.