WTL move a button with scroll bar 
Author Message
 WTL move a button with scroll bar

Hi there,

I need to move a button in a dialog window with scroll bars.

CButton myBut = GetDlgItem(ID_Button);
RECT rc;
myBut.GetWindowRect(&rc);
ScreenToClient(&rc);

then just MoveWindow etc

Code works without scroll bars, but as soon as I include scroll bars, the
GetWindowRect returns garbage for rc.top and rc.bottom. values are like
32678

How do I fix?

thx
ps I know its a little off topic but this is the best newsgroup



Wed, 14 Dec 2005 06:25:33 GMT  
 WTL move a button with scroll bar
Hi, Mostly.

Quote:

> CButton myBut = GetDlgItem(ID_Button);
> RECT rc;
> myBut.GetWindowRect(&rc);
> ScreenToClient(&rc);

In this context, WTL and ATL have no trick. GetDlgItem(), GetWindowRect(),
and ScreenToClient() just redirect to corresponding APIs.
I have tried it on Win98SE with VC6SP5 and WTL7, and there is no problem.
What's your platform and are more details?

--
Excuse my poor English.

Ueta System Design Studio
http://www1.odn.ne.jp/usdesign/ (sorry, no English page)
UETA, Shin-ichi



Thu, 15 Dec 2005 17:33:08 GMT  
 WTL move a button with scroll bar
Code does work, but if you add scroll bars using the WTL CScrollImpl class
then

GetWindowRect will return garbage values


Quote:
> Hi, Mostly.


> > CButton myBut = GetDlgItem(ID_Button);
> > RECT rc;
> > myBut.GetWindowRect(&rc);
> > ScreenToClient(&rc);

> In this context, WTL and ATL have no trick. GetDlgItem(), GetWindowRect(),
> and ScreenToClient() just redirect to corresponding APIs.
> I have tried it on Win98SE with VC6SP5 and WTL7, and there is no problem.
> What's your platform and are more details?

> --
> Excuse my poor English.

> Ueta System Design Studio
> http://www1.odn.ne.jp/usdesign/ (sorry, no English page)
> UETA, Shin-ichi




Thu, 15 Dec 2005 21:49:58 GMT  
 WTL move a button with scroll bar

Quote:

> Code does work, but if you add scroll bars using the WTL CScrollImpl class
> then
> GetWindowRect will return garbage values

I guess that the values are not garbage.

The button can be scrolled by ScrollWindowEx() in CScrollImpl::DoScroll().

--
Ueta System Design Studio
http://www1.odn.ne.jp/usdesign/ (sorry, no English page)
UETA, Shin-ichi



Fri, 16 Dec 2005 13:14:09 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Moving Scroll bar of the Scroll View

2. WTL's CScrollWindowImpl ( Disable Scroll Bars )

3. Can't Move Scroll Bar on CMainFrm

4. Moving around a Scroll Bar

5. Moving a "User Drawn" Scroll Bar

6. SetScrollInfo moves scroll bar but not Edit text

7. Scroll bar moving

8. Creating buttons adjacent to scroll bars?

9. Scroll bar with page buttons

10. Scroll bar with button.

11. Pls Help - Scroll Bar with additional buttons

12. Page Up or Page Down button under vertical scroll bar

 

 
Powered by phpBB® Forum Software