ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CButton as a window

1 REPLY 1
Reply
Message 1 of 2
Anonymous
237 Views, 1 Reply

CButton as a window

Anonymous
Not applicable
//--------------------------------------------------------------------------
---
#if !defined(ARX__WNDMAIN_H__20020623_154314)
#define ARX__WNDMAIN_H__20020623_154314

//--------------------------------------------------------------------------
---
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

//--------------------------------------------------------------------------
---
#include "resource.h"
#include "WndManage.h"
#include "WndProps.h"
#include "WndStyles.h"

class CWndMain : public CAcUiTabMainDialog {
DECLARE_DYNAMIC (CWndMain)

public:
CWndMain (CWnd* pParent =NULL, HINSTANCE hInstance =NULL) ;

//{{AFX_DATA(CWndMain)
enum { IDD = IDD_MAIN };
CAcUiTab m_tabCtrl;
CButton m_cancel;
CButton m_ok;
//}}AFX_DATA

CWndManage m_manage;
CWndProps m_props;
CWndStyles m_styles;

CRect m_wndrect;
CRect m_okrect;
CRect m_cancelrect;
CRect m_tabrect;
BOOL shown;

//{{AFX_VIRTUAL(CWndMain)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

protected:
//{{AFX_MSG(CWndMain)
afx_msg LONG OnAcadKeepFocus(UINT, UINT);
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
virtual BOOL OnInitDialog();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnDestroy();
//}}AFX_MSG

DECLARE_MESSAGE_MAP()
} ;

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately
before the previous line.

#endif //----- !defined(ARX__WNDMAIN_H__20020623_154314)
0 Likes

CButton as a window

//--------------------------------------------------------------------------
---
#if !defined(ARX__WNDMAIN_H__20020623_154314)
#define ARX__WNDMAIN_H__20020623_154314

//--------------------------------------------------------------------------
---
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

//--------------------------------------------------------------------------
---
#include "resource.h"
#include "WndManage.h"
#include "WndProps.h"
#include "WndStyles.h"

class CWndMain : public CAcUiTabMainDialog {
DECLARE_DYNAMIC (CWndMain)

public:
CWndMain (CWnd* pParent =NULL, HINSTANCE hInstance =NULL) ;

//{{AFX_DATA(CWndMain)
enum { IDD = IDD_MAIN };
CAcUiTab m_tabCtrl;
CButton m_cancel;
CButton m_ok;
//}}AFX_DATA

CWndManage m_manage;
CWndProps m_props;
CWndStyles m_styles;

CRect m_wndrect;
CRect m_okrect;
CRect m_cancelrect;
CRect m_tabrect;
BOOL shown;

//{{AFX_VIRTUAL(CWndMain)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

protected:
//{{AFX_MSG(CWndMain)
afx_msg LONG OnAcadKeepFocus(UINT, UINT);
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
virtual BOOL OnInitDialog();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnDestroy();
//}}AFX_MSG

DECLARE_MESSAGE_MAP()
} ;

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately
before the previous line.

#endif //----- !defined(ARX__WNDMAIN_H__20020623_154314)
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
It seems that my message got truncated. The question was: When I call
GetWindowRect on a CButton object, does it return the top-left and
bottom-right coordinates of the button or what? If so, are those relative
of the parent window, screen dimensions or margins of the parent window? I
am getting some rather enexpectedly huge numbers. Also, a resizable
CAcUiTabMainDialog, if I stretch it and click OK will remember not only the
window dimensions, but also the CAcUiTab control dimensions. However, it
would not remember the position of the OK and Cancel buttons. So each time
I open a previously resized dialog, the tab control will be consistent with
the size of the dialog, but the buttons' position will be the same as in the
dialog when it's called for the first time before resizing. What can I do
here to make the dialog remember the position? I suppose, I could OnSize,
after positioning the buttons save their WindowRect data, and reinstate it
on WindowShow again, but then, it becomes somewhat ugly differentiating
between the cases of the window shown for the first time and the one that
has been shown before. Is there a more elegant way of achieving this. If
someon could please post a small simple dialog box on the basis of
CAcUiTabMainDialog that is resizable and whose buttons remember their
position, I would appreciate it greatly. Unless the way I described is
pretty much the only one. Links and reference article tips are welcome

Thank you for your time.

Alex Parshikov
Iceversaka, Inc.
0 Likes

It seems that my message got truncated. The question was: When I call
GetWindowRect on a CButton object, does it return the top-left and
bottom-right coordinates of the button or what? If so, are those relative
of the parent window, screen dimensions or margins of the parent window? I
am getting some rather enexpectedly huge numbers. Also, a resizable
CAcUiTabMainDialog, if I stretch it and click OK will remember not only the
window dimensions, but also the CAcUiTab control dimensions. However, it
would not remember the position of the OK and Cancel buttons. So each time
I open a previously resized dialog, the tab control will be consistent with
the size of the dialog, but the buttons' position will be the same as in the
dialog when it's called for the first time before resizing. What can I do
here to make the dialog remember the position? I suppose, I could OnSize,
after positioning the buttons save their WindowRect data, and reinstate it
on WindowShow again, but then, it becomes somewhat ugly differentiating
between the cases of the window shown for the first time and the one that
has been shown before. Is there a more elegant way of achieving this. If
someon could please post a small simple dialog box on the basis of
CAcUiTabMainDialog that is resizable and whose buttons remember their
position, I would appreciate it greatly. Unless the way I described is
pretty much the only one. Links and reference article tips are welcome

Thank you for your time.

Alex Parshikov
Iceversaka, Inc.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report