Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show a simple Message Box #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions dialogs/Dialogs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ extern class Dialogs {
return _result;

} //folder

@:native('linc::dialogs::message')
private static function _message(message:String, caption:String) : Bool;
static inline function message(message:String, caption:String) : Bool {
var _result = _message(message, caption);

return _result;
} // message

} //Dialogs

Expand Down
1 change: 1 addition & 0 deletions linc/linc_dialogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace linc {
extern ::String open(::String title, ::Array<Dynamic> filters);
extern ::String save(::String title, Dynamic filter);
extern ::String folder(::String title);
extern ::Bool message(::String message, ::String caption);

//helpers

Expand Down
20 changes: 19 additions & 1 deletion linc/linc_dialogs_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace linc {
//forward declare common helper
std::string open_select_path(int type, const std::string &title, const std::vector<lincDialogsFilter> &filters);
std::string dialog_folder(const std::string &title);
void show_message(const std::string &message, const std::string &caption);

//Haxe facing calls

Expand Down Expand Up @@ -45,6 +46,18 @@ namespace linc {

return ::String(result.c_str());
} //folder

::Bool message(::String message, ::String caption)
{
::Bool result = false;
const std::string c_message = std::string(message.c_str());
const std::string c_caption = std::string(caption.c_str());

show_message(c_message, c_caption);
result = true;

return result;
} //message

std::string lpw_to_stdstring(const LPWSTR str, UINT page = CP_ACP) {

Expand Down Expand Up @@ -186,7 +199,12 @@ namespace linc {
return std::string();

} //open_select_file


void show_message(const std::string &message, const std::string &caption)
{
MessageBox(NULL, message.c_str(), caption.c_str(), NULL);
} //show_message

} //dialogs namespace

} //linc namespace
2 changes: 2 additions & 0 deletions test/Test.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class Test {

static function main() {

var message = Dialogs.message("This is a message.", "Title");

trace('\t\tcwd ' + Sys.getCwd());

var result =
Expand Down