|
-
May 30th, 2002, 01:21 AM
#1
Thread Starter
Hyperactive Member
CStatic and View
I have a CView which is one of three views that is seperated by
SplitterWnds. In this view i would like to create a CStatic
object which is in the entire size of the view. I would also like
it resize when the splitter is moved (thus resizing the view).
In the OnCreate function of my View i have the following
Code:
CRect rect;
this->GetClientRect(&rect);
m_wndStatic.Create("test", WS_CHILD | WS_VISIBLE | SS_GRAYRECT, rect, this, IDC_STATIC0;
the create call fails (returns a 1).
if i deflate the rect by say -10 units for each parameter (top, left,
right, and bottom) a very small static object shows.
What am i doing wrong? why is the call to GetClientRect not
filling the CRect object?
any help would be greatly appreciated.
thank you
Bababooey
Tatatoothy
Mamamonkey
-
May 30th, 2002, 04:29 AM
#2
New Member
OnCreate( _ ) method of a window class object used to reaponse the WM_CREATE. At the mean time, the window has just created but not shown yet. That's why the call to method GetWindowRect ( _ ) can get nothing.
There are many way to correct this problem. One can be the following:
In OnCreate( _ ) method:
// some things done
// then we create the static object
m_wndStatic.Create("test",
WS_CHILD | WS_VISIBLE | SS_GRAYRECT,
CRect(0,0,10,10), this);
return 0;
In the method OnSize(UINT nType, int cx, int cy) , stretch the child window m_wndStatic face to fix the parent's size:
CWnd ::OnSize(nType, cx, cy);
m_wndStatic.MoveWindow(0, 0, cx, cy);
-
May 30th, 2002, 09:26 AM
#3
Thread Starter
Hyperactive Member
where can i put the creation of the static control then?
i have it after my view calls the base class' OnCreate
so it should be a window then?
Bababooey
Tatatoothy
Mamamonkey
-
May 30th, 2002, 10:03 AM
#4
Thread Starter
Hyperactive Member
Bababooey
Tatatoothy
Mamamonkey
-
May 30th, 2002, 10:15 AM
#5
Thread Starter
Hyperactive Member
i' mhaving difficutly centering the static frame within the view
Bababooey
Tatatoothy
Mamamonkey
-
May 31st, 2002, 03:15 AM
#6
Uhhh
CStatic::Create returns BOOL, where TRUE is defined as 1...
This means it doesn't fail...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|