Page 1 of 2

Automatic gadget resizing (nxTools)

Posted: Sat Sep 29, 2007 11:50 pm
by srod
Hi,

as part of a large project (freeware) I'm working on, I find myself creating a freeware collection of tools (nxTools).

This collection will be released when complete.

I am releasing the first module (in source code form) in the hope that people can test it out on various versions of Windows etc. Of course if it is useful in its own right then all the better! :)


The nxTools_Resizing module allows for very very easy dynamic resizing of gadgets. You just issue a single command, e.g.

Code: Select all

nxTools_SetResize(#button1, #nxResize_AnchorAll)
nxTools_SetResize(#Editor1, #nxResize_AnchorLeft | #nxResize_AnchorRight)
etc.

The zip file contains the main include file (which details the two exported commands) and one demo program.

Please report any issues\bugs etc.

Download nxTools_Resize

Posted: Sun Sep 30, 2007 1:05 am
by rsts
Pretty doggone nice.

Looking forward to the package.

:D

cheers

Posted: Sun Sep 30, 2007 1:31 am
by srod
Thanks.

Bug fixed.

Posted: Sun Sep 30, 2007 1:04 pm
by srod
30th Sept 2007. -Update.

Forgot to account for the possibility of the user of this library resizing a gadget (using ResizeGadget()) setup for dynamic resizing! Doh! :oops: Afraid that Captain Brain long since sailed the 7 seas!

Have adjusted the library so that, in such cases, I allow the resize to proceed (I've got to figure the developer knows what he/she is doing!) and just reset the dynamic resizing properties to account for the new position \ size of the gadget etc.

Download in the first post.

Posted: Sun Sep 30, 2007 2:10 pm
by milan1612
Looks good, very useful :)

Posted: Sun Sep 30, 2007 2:15 pm
by JElliott
srod - great little resize lib - I did find something that might be a bug. If you take your example and resize it so just the title bar remains then expand it again the button appears to loose track of it's bottom position relative to the container.

Thanks,

Jeff

Posted: Sun Sep 30, 2007 2:26 pm
by milan1612
Hey srod, I have a little suggestion for ya :wink:

Are you familiar with the "Dock" Property of the .NET Framework WinForms?
It's kind of an enhanced anchor, I just don't know how to explain :lol: ask google...
I think that would be a great addition to this little lib.

Posted: Sun Sep 30, 2007 2:38 pm
by srod
JElliott wrote:srod - great little resize lib - I did find something that might be a bug. If you take your example and resize it so just the title bar remains then expand it again the button appears to loose track of it's bottom position relative to the container.

Thanks,

Jeff
Confirmed.

I'll take a look.

Posted: Sun Sep 30, 2007 2:53 pm
by srod
Fixed, I think!

@JElliott : would you mind testing the new version I've uploaded? Thanks.

@Milan : isn't docking just a way of keeping a control glued to one side of the parent? If so, you can easily achieve this with this little lib.

Posted: Sun Sep 30, 2007 3:09 pm
by milan1612
srod wrote:@Milan : isn't docking just a way of keeping a control glued to one side of the parent? If so, you can easily achieve this with this little lib.
Not only, .NET's Dock Property is capable of sizing the control completly
into its parent's bounds.
And it can align a control to the left, right, bottom and top of its parent, too...

Posted: Sun Sep 30, 2007 3:13 pm
by srod
Uhm, not convinced I'm afraid. Seems that you can already accomplish everything that docking has to offer just by careful placement of the gadget before applying the dynamic resizing. :)

Posted: Sun Sep 30, 2007 3:25 pm
by milan1612
srod wrote:...just by careful placement of the gadget before applying the dynamic resizing. :)
You got it! Thats exactly what I want to avoid :lol:
So that your lib can handle the position, too.
(I knew it'd be hard to explain :D )

Posted: Sun Sep 30, 2007 3:30 pm
by srod
When you apply dynamic resizing to a gadget with this lib, it takes a look at the distances of the gadget from each edge of its parent. All it does then is, whilst resizing is taking place, keeps these distances fixed for each edge specified as an anchor etc.

So, for example, if you create a gadget so that it's right edge sits alongside the right edge of it's parent (container, window etc) and then apply dynamic resizing with #nxResize_AnchorRight set for this gadget, then no matter how the parent is moved or sized, the original gadget will remain glued to the right hand edge etc. That sounds like docking to me! :wink:

Posted: Sun Sep 30, 2007 3:35 pm
by JElliott
srod wrote:Fixed, I think!

@JElliott : would you mind testing the new version I've uploaded? Thanks.
Works great - Thanks this will be very useful.

Jeff

Posted: Sun Sep 30, 2007 3:39 pm
by srod
Thanks Jeff, much appreciated.