|
|
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » How to get an "OnParentOpen" in a control
How to get an "OnParentOpen" in a control [message #24091] |
Sat, 26 December 2009 16:56  |
 |
koldo
Messages: 3435 Registered: August 2008
|
Senior Veteran |
|
|
Hello all
I would like to create a control that would know when it is located into a bigger control or window to resize inside properly.
Actually I get the Paint control event and I resize it into its parent window, but it has to be done in every Paint call...
Best regards
Koldo
Best regards
Iñaki
|
|
|
|
|
Re: How to get an "OnParentOpen" in a control [message #24105 is a reply to message #24100] |
Sat, 26 December 2009 23:42   |
|
Hi Koldo
I believe that Mirek meant virtual function Ctrl::Layout() which is called everytime when layout is computed, i.e. when resizing or when ctrl is created. If you overwrite it and put in your code it will be called once everytime you need it At least I believe that is what you need...
Best regards,
Honza
|
|
|
|
|
|
Re: How to get an "OnParentOpen" in a control [message #24144 is a reply to message #24133] |
Mon, 28 December 2009 19:46   |
|
Hi Koldo,
I've tried to code what I think you are doing. Your approach seems OK to me, I'm not sure why it doesn't work. I attached diffs of files I changed in Controls4U to add StaticImage::SetAsBackground() function. Diff of Controls4U_Demo is also attached so you can test it easily. Let me know if this is what you wanted...
Best regards,
Honza
|
|
|
|
Re: How to get an "OnParentOpen" in a control [message #24147 is a reply to message #24146] |
Tue, 29 December 2009 11:31   |
|
Hi Koldo,
I'm still not sure where's the problem The code you posted just works for me. See the attached diffs. I just added BackgroundFill and BackgroundFit options.
By the way: Why don't you use Painter for this? It would give user much more possibilities if SetFit took as an argument FILL_[H|V](PAD|REPEAT|REFLECT) and actually it would simplify the code a lot (e.g. that switch in Paint() would be unnecessary).
Best regards,
Honza
|
|
|
|
|
Re: How to get an "OnParentOpen" in a control [message #24155 is a reply to message #24154] |
Tue, 29 December 2009 18:11  |
 |
koldo
Messages: 3435 Registered: August 2008
|
Senior Veteran |
|
|
Hello Mirek
Thank you. Yes, perhaps the better solution is to modify the window, or the StaticRect where the child StaticImage belongs.
As I did not want to change StaticRect, I think the StaticImage::Layout option is enough clean and does not force to change CtrlLib code.
Of course no problem if StaticRect is changed to add a Background(Image) method. Please care that perhaps the background image can have different fit options (as Honza has indicated).
Best regards
Koldo
Best regards
Iñaki
|
|
|
Goto Forum:
Current Time: Sun May 11 12:07:47 CEST 2025
Total time taken to generate the page: 0.03686 seconds
|
|
|