View previous topic :: View next topic |
Author |
Message |
tim
Joined: 24 Jul 2005 Posts: 26
|
Posted: Wed Aug 03, 2005 5:48 am Post subject: setBounds suggestion |
|
|
I often want to set more than one property, but less than all four. It would be nice if you could do something like:
setBounds(newX, -1, newWidth, -1);
... where -1 means "keep the current value". |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Wed Aug 03, 2005 7:16 am Post subject: Re: setBounds suggestion |
|
|
tim wrote: | I often want to set more than one property, but less than all four. |
setBounds() has an extra optional parameter of type BoundsSpecified which lets you specify which of the other parameters are valid. e.g. Code: |
setBounds(10, 0, 100, 100, BoundsSpecified.X | BoundsSpecified.SIZE);
|
which sets x, width and height. But since that's actually more work, you might want to do what I do and just use the current control's bounds values to fill in the ones you don't want to change: Code: |
setBounds(left, 10, width, 100);
|
which only updates y and height. DFL is pretty good at caching values so doing that doesn't cause any extra Windows API function calls. |
|
Back to top |
|
|
tim
Joined: 24 Jul 2005 Posts: 26
|
Posted: Wed Aug 03, 2005 7:44 am Post subject: |
|
|
Too verbose.
with(myControl)
setBounds(left, top, width, 150)
... is much longer than
myControl.setBounds(-1, -1, -1, 150); |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Wed Aug 03, 2005 7:53 am Post subject: |
|
|
tim wrote: | Too verbose.
with(myControl)
setBounds(left, top, width, 150) |
for that you can simply use:
myControl.height = 150;
Quote: |
myControl.setBounds(-1, -1, -1, 150); |
-1 are valid x and y positions. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|