FLTK logo

[master] 445dcb8 - FLUID: Fix live resize for windows and tabs

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] 445dcb8 - FLUID: Fix live resize for windows and tabs "Matthias Melcher" 10:32 Apr 26  
 
commit 445dcb829dd22f0e809538cdfe4a6c3535b2057f
Author:     Matthias Melcher <github@matthiasm.com>
AuthorDate: Fri Apr 26 19:30:47 2024 +0200
Commit:     Matthias Melcher <github@matthiasm.com>
CommitDate: Fri Apr 26 19:30:47 2024 +0200

    FLUID: Fix live resize for windows and tabs

 fluid/Fl_Group_Type.cxx  | 11 +++++++----
 fluid/Fl_Window_Type.cxx |  2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git fluid/Fl_Group_Type.cxx fluid/Fl_Group_Type.cxx
index 6c09825..f42607b 100644
--- fluid/Fl_Group_Type.cxx
+++ fluid/Fl_Group_Type.cxx
@@ -720,10 +720,13 @@ void Fl_Tabs_Type::remove_child(Fl_Type* cc) {
 }
 
 Fl_Widget *Fl_Tabs_Type::enter_live_mode(int) {
-  Fl_Tabs *grp = new Fl_Tabs(o->x(), o->y(), o->w(), o->h());
-  propagate_live_mode(grp);
-  grp->value(((Fl_Tabs*)o)->value());
-  return grp;
+  Fl_Tabs *original = static_cast<Fl_Tabs*>(o);
+  Fl_Tabs *clone = new Fl_Tabs(o->x(), o->y(), o->w(), o->h());
+  propagate_live_mode(clone);
+  int tab_index = original->find(original->value());
+  if ((tab_index>=0) && (tab_index<clone->children()))
+    clone->value(clone->child(tab_index));
+  return clone;
 }
 
 // ---- Fl_Scroll_Type ------------------------------------------------- MARK: -
diff --git fluid/Fl_Window_Type.cxx fluid/Fl_Window_Type.cxx
index b68af44..2e77d38 100644
--- fluid/Fl_Window_Type.cxx
+++ fluid/Fl_Window_Type.cxx
@@ -1519,7 +1519,7 @@ void Fl_Widget_Class_Type::write_code2(Fd_Code_Writer& f) {
 // live mode support
 
 Fl_Widget *Fl_Window_Type::enter_live_mode(int) {
-  Fl_Window *win = new Fl_Window(o->x(), o->y(), o->w(), o->h());
+  Fl_Window *win = new Fl_Window(10, 10, o->w(), o->h());
   return propagate_live_mode(win);
 }
 
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'.