Automatic gadget resizing (nxTools)

Developed or developing a new product in PureBasic? Tell the world about it.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Automatic gadget resizing (nxTools)

Post 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
I may look like a mule, but I'm not a complete ass.
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

Pretty doggone nice.

Looking forward to the package.

:D

cheers
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Thanks.

Bug fixed.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
I may look like a mule, but I'm not a complete ass.
milan1612
Addict
Addict
Posts: 894
Joined: Thu Apr 05, 2007 12:15 am
Location: Nuremberg, Germany
Contact:

Post by milan1612 »

Looks good, very useful :)
Windows 7 & PureBasic 4.4
JElliott
User
User
Posts: 16
Joined: Mon Sep 03, 2007 3:44 pm
Location: Connecticut, USA

Post 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
milan1612
Addict
Addict
Posts: 894
Joined: Thu Apr 05, 2007 12:15 am
Location: Nuremberg, Germany
Contact:

Post 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.
Windows 7 & PureBasic 4.4
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
I may look like a mule, but I'm not a complete ass.
milan1612
Addict
Addict
Posts: 894
Joined: Thu Apr 05, 2007 12:15 am
Location: Nuremberg, Germany
Contact:

Post 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...
Windows 7 & PureBasic 4.4
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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. :)
I may look like a mule, but I'm not a complete ass.
milan1612
Addict
Addict
Posts: 894
Joined: Thu Apr 05, 2007 12:15 am
Location: Nuremberg, Germany
Contact:

Post 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 )
Windows 7 & PureBasic 4.4
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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:
I may look like a mule, but I'm not a complete ass.
JElliott
User
User
Posts: 16
Joined: Mon Sep 03, 2007 3:44 pm
Location: Connecticut, USA

Post 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
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Thanks Jeff, much appreciated.
I may look like a mule, but I'm not a complete ass.
Post Reply