|
yogendra kaushik wrote: because i try the previous one which doesnot solve my problem
Show the code that is not working.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
But you do want to get some help, don't you?
Outbursts like this won't make anyone more willing to help you out.
|
|
|
|
|
yogendra kaushik wrote: IDONT ASK IT FRM U THEN WHY R U BEHAVE LIKE THIS
If you behave like this you will get answer from nobody
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
I create a CTabCtrl in CMainFrame::OnCreate like this:
//define in MainFrm.h
CTabCTrl m_wndTab;
//implement in MainFrm.cpp
m_wndTab.Create(TCS_TABS | TCS_FIXEDWIDTH | WS_CHILD | WS_VISIBLE,
CRect(0,0,200,20), this, 0x1006);
m_wndTab.ShowWindow(SW_SHOW);
But there is nothing i can see.
Why??
|
|
|
|
|
And I found that if I use a CReBar to hold the CTabCtrl,everything is right.
But how to do so without a CReBar object???
|
|
|
|
|
Rather than directly add a tab control to main frame, you can easily put it in a dialogbar. So, add a dialogbar template resurce and put a tab control in it. Then add a CDialogBar type member in CMainFrame class, create the dialogbar in CMainFrame::OnCreate and handle TCN_SELCHANGE notification.
Here is a sample code:
class CMainFrame : public CFrameWnd
{
CDialogBar m_dlgBar;
afx_msg void OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult);
DECLARE_MESSAGE_MAP()
};
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnSelchangeTab)
END_MESSAGE_MAP()
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
m_dlgBar.Create(this, IDD_DIALOGBAR,
CBRS_TOP|CBRS_TOOLTIPS|CBRS_FLYBY,
IDD_DIALOGBAR);
CTabCtrl* pTab = (CTabCtrl*)m_dlgBar.GetDlgItem(IDC_TAB1);
pTab->InsertItem(0, _T("RED"));
return 0;
}
void CMainFrame::OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult)
{
}
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CFrameWnd::OnSize(nType, cx, cy);
if( m_dlgBar.GetSafeHwnd() )
{
CTabCtrl* pTab = (CTabCtrl*)m_dlgBar.GetDlgItem(IDC_TAB1);
CRect rcDlg;
m_dlgBar.GetClientRect( rcDlg );
pTab->SetWindowPos(NULL, 0, 0, rcDlg.Width(), rcDlg.Height(),
SWP_NOZORDER );
}
}
Best regards,
Ovidiu
-- modified at 7:07 Wednesday 21st June, 2006
|
|
|
|
|
Yes,you are right.Much nicer than use a CReBar.
Thank you very much.;);P
|
|
|
|
|
sorry,still a question.
Do I have to create a new class for the dialogBar If I want to change CTabCtrl into a CMyTabCtrl?
And from your way,how could I use the tabctrl directly from CMainFrame? If I create a new class for DialogBar,direct is impossible.
|
|
|
|
|
Although I don't see a good reason here to derive from CTabCtrl, let's say we do it.
Derive also from CDialogBar, first do some "cosmetics" like seen below, then add a CMyTabCtrl member.
#include "MyTabCtrl.h"
class CMyDialogBar : public CDialogBar
{
public:
CMyDialogBar();
enum { IDD = IDD_DIALOGBAR };
CMyTabCtrl m_tabCtrl;
protected:
virtual void DoDataExchange(CDataExchange* pDX);
protected:
LRESULT OnInitDialog(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
};
CMyDialogBar::CMyDialogBar()
{
}
void CMyDialogBar::DoDataExchange(CDataExchange* pDX)
{
CDialogBar::DoDataExchange(pDX);
DDX_Control(pDX, IDC_TAB1, m_tabCtrl);
}
BEGIN_MESSAGE_MAP(CMyDialogBar, CDialogBar)
ON_MESSAGE(WM_INITDIALOG, OnInitDialog)
END_MESSAGE_MAP()
LRESULT CMyDialogBar::OnInitDialog(WPARAM wParam, LPARAM lParam)
{
if(! HandleInitDialog(wParam, lParam) || !UpdateData(FALSE))
{
TRACE0("Warning: UpdateData failed during dialog init.\n");
return LRESULT(0);
}
return LRESULT(1);
}
Then do not forget to chage the CDialogBar to CMyDialogBar in CMainFrame class, the rest remains like in my first example (handling TCN_SELCHANGE notification and so on).
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
Perhaps your control is covered by another elements.
Try placing it on the top after creation:
m_wndTab.SetWindowPos( &CWnd::wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
|
|
|
|
If you need an additional toolbar, take a look at CMainFrame::OnCreate handler how the default toolbar is created. You will see how the bitmap image is assigned and how the control is docked.
|
|
|
|
|
I order to be docked, I suppose the control bar should implement some virtual functions like CalcDynamicLayout and CalcFixedLayout .
Instead of CTabCtrl , maybe you can use CToolBar , wich incorporates a CTabCtrl , accessible by GetToolBarCtrl() .
As a sample of resizable control bar, you can take a look at http://www.datamekanix.com[^].
|
|
|
|
|
I have a CRichEditCtrl , in a certain point i want to change the font, so what i will add to the rich edit using ReplaceSel will be in the new font i have selected...
I am using this code:
CHARFORMAT2 cf;
::ZeroMemory(&cf,sizeof(CHARFORMAT2));
cf.cbSize = sizeof(CHARFORMAT2);
int iTotalTextLength = GetWindowTextLength();
m_edtChatMsg.SetSel(iTotalTextLength, iTotalTextLength);
m_edtChatMsg.GetSelectionCharFormat(cf);
cf.dwMask = CFM_FACE | CFM_SIZE;
_tcscpy(cf.szFaceName,lpszFaceName);
cf.yHeight = nFontSize;
m_edtChatMsg.SetSelectionCharFormat(cf);
unfortunately this code isn't working
can any1 help?
thanks in advanced
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
Maybe instead of GetWindowTextLength() you should use m_edtChatMsg.GetTextLength() ?
|
|
|
|
|
no, it didn't help... although it was a small bug of mine
still, can't change the rich edit font
any other suggestions?
thanks
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
The next fragment sets the font and append a text:
long len = m_cRich.GetTextLength();
m_cRich.SetSel(len, len);
CHARFORMAT2 cf;
ZeroMemory(&cf, sizeof(cf));
cf.dwMask = CFM_FACE | CFM_SIZE;
lstrcpy(cf.szFaceName, _T("Courier New"));
cf.yHeight = 400;
m_cRich.SetSelectionCharFormat(cf);
m_cRich.ReplaceSel(_T("New text"));
It works.
-- modified at 6:16 Wednesday 21st June, 2006
|
|
|
|
|
thanks
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
See Here[^] maybe it is some helpful to you
whitesky
|
|
|
|
|
how we can get GMT time without using Current time
|
|
|
|
|
|
|
this is my code not workin
CTime time;
time.GetGmtTm(NULL);
m_time.Format("%d:%d:%d",time.GetHour(),time.GetMinute(),time.GetSecond());
|
|
|
|
|
sree_as wrote: this is my code not workin
What means 'not working' ? Compile error, runtime error, the code does not behave as expected (and supply information), or some other crazy thing...
Please, when asking a question, remember that we cannot see what you see !
Did you even try to read the links we gave you ?
This will do nothing:
time.GetGmtTm(NULL);
because you don't store the result. And you also constructed an uninitialised CTime object so it doesn't contain a valid date. Did you read the link I posted ? It describes how to construct a CTime with the current date and time.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
actually my problem is i have one dialog on that one combo box contains contry list and one static text for digital time.
it's is working.
but when we open my window time and u convert to another contry automatically our time changing.
due this currentTime().because when we changed it to another all will going wrong,
please help
sree.
|
|
|
|
|
You still didn't explain what the problem was. 'All will going wrong' won't help me very much to give you a detailed solution.
Where are you stuck ? What is the problem you are having ?
Did you read both links that we gave you ? They should contain enough information for you to know what to do. If not, is there something you didn't understand ?
And also, when explaining your problem, get rid of everything that is not related to the problem. Focus on the problem only.
Cédric Moonen
Software developer
Charting control
|
|
|
|