Re: RE Questions about IDE and perhaps Win32Lib
- Posted by Ray Tomes <rtomes at ihug.co.nz> Jun 25, 2003
- 447 views
> Ray wrote: >>3. In Win32Lib a control can be declared as EITHER a number of pixels OR a >>proportion of the parent size e.g. .25 for a quarter. I tried to do this >>also in IDE but it didn't work. Is it possible to do this in IDE? Judith Evans wrote: > This is also on my ToDo list. The best you can do right now is use > "Alternate Positions" in Properties. You use the X,Y,CX,CY you use now to > move and resize the control. The downside is you will not see how the > controls actually look until you MenuRun or MenuTempRun. This is not a > trivial change basically because all the control movements are by pixel X,Y. > I have been successful at translating a percentage X and Y to Design but > when the control moves or resizes, I'm having problems adjusting the pixel > X,Y back to a percentage. I know, I know, this doesn't sound like a big deal > but it has been. Well if it is a function already in Win32Lib, why does IDE need to do anything but make it available? One possible problem, which may be what you are up against is that percentages don't necessarily add up. For example 25% of 15 pixels would be 4 to the nearest one, but 4 lots of 4 makes 16 and is a pixel to big. So buttons may have cracks between or slightly overlap. If this is your problem then I can offer you a solution. First convert from x, y, cx, cy to x, y, (x+cx), (y+cy) and then proportion these by the % and then convert back to x, y, cx, cy. Example: x=.30, y=.10, cx=.06, cy=.03 ==> x=.30, y=.10, (x+cx)=.36, (y+cy)=.13 and then for a 800x600 window this gives 240, 60, 288, 78 which are all integers so it would have worked anyway. But for a 1024x768 window 307.2, 76.8, 368.64, 99.84 which are then converted to nearest integer giving 307, 77, 369, 100 and so you get x=307, y=77, cx=62, cy=23. What this method does is ensure that two object edges which fitted exactly before still fit perfectly after scaling (whereas scaling x, y, cx, cy will not achieve this). Previously identical sized objects may vary in size by 1 pixel which should not be a problem. It can be avoided by very careful selection of grid sizes to start with.