FLTK logo

[master] e2028c6 - STR 2936: FLUID: option to ignore syntax check in DeclBlock

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] e2028c6 - STR 2936: FLUID: option to ignore syntax check in DeclBlock "Matthias Melcher" Jan 26, 2023  
 
commit e2028c66fea5fd3d4ee16de098ed596e8fc0688c
Author:     Matthias Melcher <github@matthiasm.com>
AuthorDate: Thu Jan 26 16:23:35 2023 +0100
Commit:     Matthias Melcher <github@matthiasm.com>
CommitDate: Thu Jan 26 16:32:17 2023 +0100

    STR 2936: FLUID: option to ignore syntax check in DeclBlock

 fluid/Fl_Function_Type.cxx | 27 ++++++++++++++++-----------
 src/fl_ask.cxx             |  6 ++++--
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git fluid/Fl_Function_Type.cxx fluid/Fl_Function_Type.cxx
index c19077b..eeb11ee 100644
--- fluid/Fl_Function_Type.cxx
+++ fluid/Fl_Function_Type.cxx
@@ -1401,23 +1401,28 @@ void Fl_DeclBlock_Type::open() {
   declblock_panel->show();
   const char* message = 0;
   for (;;) { // repeat as long as there are errors
-    if (message) fl_alert("%s", message);
     for (;;) {
       Fl_Widget* w = Fl::readqueue();
       if (w == declblock_panel_cancel) goto BREAK2;
       else if (w == declblock_panel_ok) break;
       else if (!w) Fl::wait();
     }
-    const char*c = decl_before_input->value();
-    while (isspace(*c)) c++;
-    message = c_check(c&&c[0]=='#' ? c+1 : c);
-    if (message) continue;
-    name(c);
-    c = decl_after_input->value();
-    while (isspace(*c)) c++;
-    message = c_check(c&&c[0]=='#' ? c+1 : c);
-    if (message) continue;
-    storestring(c,after);
+    const char* a = decl_before_input->value();
+    while (isspace(*a)) a++;
+    const char* b = decl_after_input->value();
+    while (isspace(*b)) b++;
+    message = c_check(a&&a[0]=='#' ? a+1 : a);
+    if (!message)
+      message = c_check(b&&b[0]=='#' ? b+1 : b);
+    if (message) {
+      int v = fl_choice("%s", "try again", "keep anyway", "cancel", message);
+      printf("%d\n", v);
+      if (v==0) continue; // try again
+      if (v==1) ; // keep input
+      if (v==2) goto BREAK2;
+    }
+    name(a);
+    storestring(b, after);
     if (public_ != declblock_public_choice->value()) {
       set_modflag(1);
       public_ = declblock_public_choice->value();
diff --git src/fl_ask.cxx src/fl_ask.cxx
index 3fe0e2e..5657cd3 100644
--- src/fl_ask.cxx
+++ src/fl_ask.cxx
@@ -208,8 +208,10 @@ int fl_ask(const char *fmt, ...) {
   \param[in] b0 text label for right button 0
   \param[in] b1 text label for middle button 1 (can be 0)
   \param[in] b2 text label for left button 2 (can be 0)
-  \retval 0 if the button with \p b0 text is pushed
-  \retval 1 if the button with \p b1 text is pushed
+  \retval 0 if the button with \p b0 text is pushed or the user pressed
+      the \c Escape key or clicked the window close button
+  \retval 1 if the button with \p b1 text is pushed or the user pressed
+      the \c Return key
   \retval 2 if the button with \p b2 text is pushed
 */
 int fl_choice(const char *fmt, const char *b0, const char *b1, const char *b2, ...) {
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.