FLTK logo

Re: [fltk.general] Problem with Fl_Pack

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.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Problem with Fl_Pack Ian MacArthur Jan 04, 2022  
 
On 4 Jan 2022, at 20:56, david allen wrote:
> 
> All children take the label of the last child. I've tried a few things like using "add" and specifying labels apart from the constructors to no avail.


David,

You’ve used the same char array “label” for all the labels, so that’s why they are the same...

If you are doing that, you need to use the copy_label() method rather than just the label() method. 

Check the docs, but basically label() just retains a pointer to the array you use, so if it then changes or goes out of scope, bad things can happen. If you use copy_label() the widget will make a local copy and then it doesn’t matter what happens to the “label” array - but costs you more memory...

This is true of all fltk labels, I think, and is not peculiar to the Fl_Pack class.

-- 
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/DDCC6336-A625-4DDB-B7D9-10B8602EC950%40gmail.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]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'.