FLTK logo

Re: is it safe to sort children?

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: is it safe to sort children? Greg Ercolano Mar 27, 2007  
 
Stan wrote:
	Maybe you don't even need to call insert() if your just moving
	widgets around, since 'sorting' has more to do with the widget
	x/y positions than it does with their position in the internal
      arrays.

Exactly. I just add() the widgets, then sort the child
array by x/y position.

	Right, so if you're just tweaking the x()/y() positions
	of the widgets to sort, then call redraw() on the parent,
	that should be pretty fast I'd think. Just a single array walk
	would be involved to shuffle around the x()/y() values.

	Just be sure your array walk loop doesn't involve a find()
	for each widget lookup, as that would exponentially suck
	cpu for each new widget added.

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'.