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 » U++ Library support » U++ Library : Other (not classified elsewhere) » How to change the ZOrder of childcontrols at runtime?
How to change the ZOrder of childcontrols at runtime? [message #35595] Sat, 03 March 2012 10:07 Go to next message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
I have a window with dynamically created childcontrols on it.
Some of them overlap and I want to bring the bottom one to the top.
How do I do this?

[edit]

What I found that works is to removechild() and then add() again,
but this does not seem right. What is the correct way?

[Updated on: Sat, 03 March 2012 10:30]

Report message to a moderator

Re: How to change the ZOrder of childcontrols at runtime? [message #35597 is a reply to message #35595] Sat, 03 March 2012 11:29 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
slashupp wrote on Sat, 03 March 2012 04:07

I have a window with dynamically created childcontrols on it.
Some of them overlap and I want to bring the bottom one to the top.
How do I do this?

[edit]

What I found that works is to removechild() and then add() again,
but this does not seem right. What is the correct way?



Well, it is a correct way.

You are however not required to removechild first and in fact it is better not to do so (U++ can optimize the process if parent does not change, eventual focus stays).

Also note there is 'insafter' parameter to AddChild and there is also AddChildBefore method.

Anyway, plain simple serie of 'Add' for all child widgets in order you need should work just fine.

Or to bring any widget on top, just Add it again.

Mirek

[Updated on: Sat, 03 March 2012 11:30]

Report message to a moderator

Re: How to change the ZOrder of childcontrols at runtime? [message #35599 is a reply to message #35597] Sat, 03 March 2012 11:50 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
Thanks mirek

Just to double-check:

Will Add(myctrl) add it to the window only once regardless of how many times I call it?

Seems with upp that the moment I start to look for a complex way
to do something, I'm doing it wrong Smile
Re: How to change the ZOrder of childcontrols at runtime? [message #35600 is a reply to message #35599] Sat, 03 March 2012 13:59 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
slashupp wrote on Sat, 03 March 2012 05:50

Thanks mirek

Just to double-check:

Will Add(myctrl) add it to the window only once regardless of how many times I call it?



Uhm, depend on how you define "add it". The effect is more or less same as remove/add pair (except details). "myctrl" is just one entity, it cannot be somewhere "twice". Add has inside logic that makes sure it is properly removed from previous location.

Note: You can even Add(myctrl) to other window, effectively moving it from one window to other.
Previous Topic: Drawing with masks
Next Topic: Uniq blocking with multiple users logged into same machine
Goto Forum:
  


Current Time: Thu Mar 28 15:06:26 CET 2024

Total time taken to generate the page: 0.01142 seconds