Weird rect.bottom value - FTL! - Download example

Pages: 12
PS
If you come back and say that doesn't work - I won't believe you :-}
Finally!!!
Indeed, perseverance is the key to success!
It does work now, f**k you Murphy and your laws!

Time to continue our journey. I have removed the condition that blocks the re-sizing of the window if it is less than 600 px. Now I have a little problem when I do this: http://www.devimperium.info/screen6.jpg.

I must find a way to stop the re-sizing when it gets to a minimum value.

Anyway, the hard part has been superseded. Thanks guestgulkan, from all the forums on which I have opened this topic, this was the only one that gave me a hand.

P.S. The code have been updated and uploaded
Last edited on
alexbnc wrote:
I must find a way to stop the re-sizing when it gets to a minimum value.


You need to intercept the WM_GETMINMAXIFO message.

This message is sent just before the WM_SIZE message is sent - and it allows you to set
things like the minimum and maximum tracking sizes for the window.
Well, I found a way to do it without WM_GETMINMAXIFO but I have another problem, when I add a third control below desc_panel.
Take a look at this: http://www.devimperium.info/screen7.jpg

It's like the BOTTOM of desc_panel is 0 for that function.
I uploaded the new code at http://www.devimperium.info/ResizeTest.zip
I have been anticipating this question - this is going to turn out to be the simpleton way we have been calculating where the top of each of the windows are located.

Because the GetClientRect gets the size of the client area of ANY window (so top and left are always 0) and right and bottom gives us the width of the client area of the window.

It does NOT in the case of a child window tell us where the child window is located within the
parent window.
So you cannot say that the bottom of the window is rect.bottom.

You have to keep a running total of the Y (vertical) positioning as you position the windows.
Last edited on
If I know that the first control starts always at top 5px I can add its height to that and obtain the bottom. I remember the existence of a function that specifies behind, before or after what controls should another one be placed. I don't remember what function was that. I just remember that it was some windows message with wParam or lParam like ??_AFTER, ??_BEFORE.
That would save a lot of time and resources. I feel like what I am doing is not the conventional way of re-sizing elements.
Last edited on
Bugger, I have updated the code , but my broadband went down so I'll have to write it again.
Now, the main and last problem is that text_lines() doesn't return a correct value always.
I have updated the code (main.cpp) - I have uploaded it to pastebin - the url is :
http://pastebin.com/sFRmk3rj

The file is called resize_test .txt so when you download it just change the name.


You will notice 3 things:

1. I stopped using hard coded numbers and have made some #defines at the top of the page.
much better and easier to do things that way.

2. So in the WM_SIZE message of the head_proc you will see the way the position of the windows are calculated.
So they now behave correctly - no overlapping.

3. You will see in the main_proc - that I have changed the initial positions/positions of the title_panel, and desc_panel
and desc_panel2 to 1,1,1,1 - thi same me a bit of typin effort - AND WM_SIZE is one of the first messages sent when
a window is first shown so all the windows will take their proper positions and sizes from the start.


/* Other stuff*/
It wasn't particularly that you were calculating the positions of
the windows using improper methods - it was just that we were sloppy
and it would only get worse the more code we added.
OMG, It is exactly what I have done, excepting the definition of the left, top and spacing values and the change of the initial position and size.
Happy to see that I am not the only one programming this way, even if I know that I have to improve my code. Well, now I have to make the text_lines() function more precise and that's all.

Thanks guestgulkan, you saved the world from the WW III (not from WW IV, unfortunately :D)
Time to mark this as SOLVED.
Topic archived. No new replies allowed.
Pages: 12