DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2562
Version: 1.3-feature


Currently fl_message and friends just has a blank title. That's not very
user friendly, especially if it's the only window open by the application.

The attached patch gives the ability to change the title. I choose the
route of a separate function rather than extending the normal ones to
avoid breaking existing code.


Link: http://www.fltk.org/str.php?L2562
Version: 1.3-feature
diff -up fltk-1.3.x-r8411/FL/fl_ask.H.orig fltk-1.3.x-r8411/FL/fl_ask.H
--- fltk-1.3.x-r8411/FL/fl_ask.H.orig   2011-02-11 14:36:15.524746578 +0100
+++ fltk-1.3.x-r8411/FL/fl_ask.H        2011-02-11 14:38:24.706083877 +0100
@@ -67,6 +67,9 @@ inline void fl_message_font(Fl_Font f, F
 FL_EXPORT void fl_message_hotspot(int enable);
 FL_EXPORT int fl_message_hotspot(void);
 
+FL_EXPORT void fl_message_title(const char *title);
+FL_EXPORT const char *fl_message_title(void);
+
 // pointers you can use to change FLTK to a foreign language:
 extern FL_EXPORT const char* fl_no;
 extern FL_EXPORT const char* fl_yes;
diff -up fltk-1.3.x-r8411/src/fl_ask.cxx.orig fltk-1.3.x-r8411/src/fl_ask.cxx
--- fltk-1.3.x-r8411/src/fl_ask.cxx.orig        2011-02-11 14:36:21.303701107 
+0100
+++ fltk-1.3.x-r8411/src/fl_ask.cxx     2011-02-11 14:43:29.547435424 +0100
@@ -503,6 +503,26 @@ int fl_message_hotspot(void) {
   return enableHotspot;
 }
 
+/** Sets the title of the current default dialog used in 
+    many common dialogs like fl_message(), fl_alert(), 
+    fl_ask(), fl_choice(), fl_input(), fl_password() 
+    \note \#include <FL/fl_ask.H>
+*/ 
+void fl_message_title(const char *title) {
+  makeform();
+  message_form->copy_label(title);
+}
+
+/** Gets the title of the current default dialog used in 
+    many common dialogs like fl_message(), fl_alert(), 
+    fl_ask(), fl_choice(), fl_input(), fl_password() 
+    \note \#include <FL/fl_ask.H>
+*/ 
+const char *fl_message_title(void) {
+  makeform();
+  return message_form->label();
+}
+
 /** @} */
 
 //
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to