Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Coffee corner » Quiz #5
Quiz #5 [message #57897] Mon, 27 December 2021 17:41 Go to next message
mirek is currently offline  mirek
Messages: 13986
Registered: November 2005
Ultimate Member
What does this layout designer button do?

index.php?t=getfile&id=6551&private=0
  • Attachment: layout.png
    (Size: 17.94KB, Downloaded 217 times)
Re: Quiz #5 [message #57907 is a reply to message #57897] Mon, 27 December 2021 21:04 Go to previous messageGo to next message
Lance is currently offline  Lance
Messages: 534
Registered: March 2007
Contributor
mirek:

Yeah, it's a very handy facility. I tried and learned something new.

When designing layout, we turn to add new Ctrl, copy& paste, and moving things around, resulting in Ctrls not in sensible tab-order. By selecting a group of Ctrls and apply the button, the layout designer will order the Ctrls in a left-to-right-top-to-bottom order so navigate by tabbing will not seem to be random.

Note the selected Ctrls will be removed from the layout and then insert to the very front of the layout after sorting by their position.

Great to know. I used to do it manually with a lot of effort and many rounds of try-and-error.
Re: Quiz #5 [message #57910 is a reply to message #57907] Mon, 27 December 2021 23:50 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13986
Registered: November 2005
Ultimate Member
Lance wrote on Mon, 27 December 2021 21:04
mirek:

Yeah, it's a very handy facility. I tried and learned something new.

When designing layout, we turn to add new Ctrl, copy& paste, and moving things around, resulting in Ctrls not in sensible tab-order. By selecting a group of Ctrls and apply the button, the layout designer will order the Ctrls in a left-to-right-top-to-bottom order so navigate by tabbing will not seem to be random.

Note the selected Ctrls will be removed from the layout and then insert to the very front of the layout after sorting by their position.

Great to know. I used to do it manually with a lot of effort and many rounds of try-and-error.


BTW, it is a rare example of bubblesort usecase Smile

The one and only advantage of pure bubblesort is that it can work well when the sorting predicate has "fuzzy" state (the ordering of two elements is not known), which is sometimes the case when deciding order here...
Re: Quiz #5 [message #57912 is a reply to message #57910] Tue, 28 December 2021 02:35 Go to previous messageGo to next message
Lance is currently offline  Lance
Messages: 534
Registered: March 2007
Contributor
I will need to take a look at the source to see what you mean exactly by "fuzzy". I suppose you mean the exact ordering of two controls cannot be determined by their size/position alone, eg, need to take into consideration of surrounding ones?
Re: Quiz #5 [message #57913 is a reply to message #57912] Tue, 28 December 2021 03:04 Go to previous messageGo to next message
Lance is currently offline  Lance
Messages: 534
Registered: March 2007
Contributor
It's good to understand the logic the system used to order Ctrls. So I copy the Predicate here
bool RectLess(const Rect& a, const Rect& b)
{
	int d = min(a.bottom, b.bottom) - max(a.top, b.top);
	int w = min(a.GetHeight(), b.GetHeight());
	return d > w / 2 ? a.left < b.left : a.top < b.top;
}

If the height of common vertical part is over half of height of the shorter ctrs, compare horizontally, otherwise , compare vertically.

Given any two Ctrls, the predicate is deterministic. Is this predicate not transitive, ie. a<b, b<c doesn't imply a<c? What if we pass the predicate to a quicksort like algorithm?

[Updated on: Tue, 28 December 2021 03:05]

Report message to a moderator

Re: Quiz #5 [message #57918 is a reply to message #57912] Tue, 28 December 2021 09:29 Go to previous message
mirek is currently offline  mirek
Messages: 13986
Registered: November 2005
Ultimate Member
I believe that if we used quicksort, results could be quite unpredictable.

Previous Topic: Some Experiment with Size of Upp Executable
Next Topic: lua binding of Ultimate++
Goto Forum:
  


Current Time: Sun Jun 16 21:07:54 CEST 2024

Total time taken to generate the page: 0.01563 seconds