|
Hi,
i used InvalidateRect();
Please look in the small code
Many thanx
Coc
|
|
|
|
|
This is the code from the doc:
CString CON_UPDATE_DEMODoc::ChangeText()
{
CRect MyRect(0,0, 100, 100);
CObject* pHint = (CObject*)&MyRect;
m_cstrAusgabe = " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \r\n\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
m_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \r\n\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
m_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \r\n\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
m_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \r\n\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
m_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \r\n\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER";
UpdateAllViews(NULL, 1, pHint);
return m_cstrAusgabe;
}
and this from the view:
void CON_UPDATE_DEMOView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
CMainFrame *pMF = DYNAMIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
CON_UPDATE_DEMODoc *pDoc = DYNAMIC_DOWNCAST(CON_UPDATE_DEMODoc, pMF->GetActiveDocument());
m_Rich.SetWindowText(pDoc->m_cstrAusgabe);
if (pHint != 0)
{
InvalidateRect((CRect*)pHint, TRUE);
m_Rich.SetWindowText(pDoc->m_cstrAusgabe);
return;
}
m_Rich.SetModify(TRUE);
CView::OnUpdate(pSender, lHint, pHint);
}
|
|
|
|
|
CrocodileBuck wrote: m_Rich.SetWindowText(pDoc->m_cstrAusgabe);
Since m_Rich is a CRichEditCtrl , why not just derive your view from CRichEditView ? Or, you can derive it from CFormView and add a CRichEditCtrl to it. Otherwise, the way you rare going about this is all wrong.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i have a project from VC++ 6.
i converted it to vc++.net 2005.
when i rebuild the program an error appears : "string table error"
i have the last version compiled and its work fine.
do you have any idea why this error occurs?
sometimes 0 can be 1
|
|
|
|
|
I think you should ask this question in the NET forum.
regards
Bram van Kampen
|
|
|
|
|
Dear All,
I have some problem in displaying the Cbitmatbutton during the SetFocus and KillFocus event. Interestingly, if I disable the bitmapbutton and load the bitmap then it is working fine. If I didnt use the Enablewindow method then the bitmap is not loaded correctly.
But when I use the Enablewindow method in PreTranslateMessage() I have some other problem, that is I need to change the bitmap when pressing the Enter key in the button. If I disable the window and change means it is working but the keyboard event is not accepted after I disble and enable after pressing the enter key. This means that I cannot use the keyboard inputs after pressing the enter key. Please refer the below code:
My exact requirement is that, I need to change the bitmap of the button on Lostfocus, Killfocus and while pressing Enter key.
BOOL CdfdgDlg::PreTranslateMessage(MSG *pMsg)
{
if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN))
{
CWnd* pWnd = GetFocus();
int CtrlID = pWnd->GetDlgCtrlID();
if(CtrlID==IDC_BUTTON4)
{
m_button4.EnableWindow(false);
m_button4.LoadBitmaps(IDB_BITMAP4,IDB_BITMAP4,NULL,NULL);
m_button4.EnableWindow(true);
return TRUE;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
void CdfdgDlg::OnBnKillfocusButton4()
{
m_button4.EnableWindow(false);
bool val=m_button4.LoadBitmaps(IDB_BITMAP1,NULL,IDB_BITMAP1,NULL);
m_button4.EnableWindow(true);
}
void CdfdgDlg::OnBnSetfocusButton4()
{
m_button4.EnableWindow(false);
bool val=m_button4.LoadBitmaps(IDB_BITMAP2,NULL,IDB_BITMAP2,NULL);
m_button4.EnableWindow(true);
m_button4.SetFocus();
}
|
|
|
|
|
1. If your dialog is modal, PreTranslateMessage doesn't work[^].
2. You don't need to disable and then re-enable the button just to change its bitmap. Instead, do something like this:
m_button4.LoadBitmaps(IDB_BITMAP1,0,IDB_BITMAP1,0);
m_button4.Invalidate();
m_button4.UpdateWindow() Your disable/enable calls have a side effect of getting the button to repaint. Unfortunately, they also change the state of the button twice, which creates a lot of ugly flicker.
3. In your OnBnSetfocusButton4() handler, you call SetFocus on the button that you're being notified has received the focus. That's not going to do anything useful.
|
|
|
|
|
Hello Gary,
You are genius. It is working properly for SetFocus, KillFocus and also when ENTER key is pressed, but now I got a new problem. The problem is that, when a ENTER key is pressed on the CBitmapbutton I display a "MessageBox", due to this MessageBox focus to the control is lost and bitmap is changed as per the events in KillFocus and when the control is gained to the control the SetFocus event is called.
I want to make the button as it is when I display a MessageBox after pressing ENTER key. Please advice.
|
|
|
|
|
You might try something like this:
class CdfdgDlg
{
private:
bool HandlingEnterKey;
};
CdfdgDlg::CdfdgDlg()
: HandlingEnterKey(false)
{
};
BOOL CdfdgDlg::PreTranslateMessage(MSG *pMsg)
{
if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN))
{
if (GetFocus() == &m_button4)
{
HandlingEnterKey = true;
MessageBox();
HandlingEnterKey = false;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
void CdfdgDlg::OnBnKillfocusButton4()
{
if (!HandlingEnterKey)
{
m_button4.LoadBitmaps(IDB_BITMAP1,NULL,IDB_BITMAP1,NULL);
m_button4.Invalidate();
m_button4.UpdateWindow();
}
}
void CdfdgDlg::OnBnSetfocusButton4()
{
if (!HandlingEnterKey)
{
m_button4.LoadBitmaps(IDB_BITMAP2,NULL,IDB_BITMAP2,NULL);
m_button4.Invalidate();
m_button4.UpdateWindow();
}
} I'vd added a flag to your dialog class. This flag, HandlingEnterKey is set to true while you're displaying the message box. When it is true, the logic that changes the bitmaps on the buttons in the lose focus / get focus handlers will leave the bitmaps alone. If I understand correctly, this will do what you want.
Good luck.
|
|
|
|
|
how create and handle tab controls in vc++
|
|
|
|
|
Just drag and drop Tab Control from ToolBox to your dialog.Attach a control variable to it and proceed to work.
-@SuDhIrKuMaR@-
|
|
|
|
|
how will change view on click on tab button
|
|
|
|
|
TCN_SELCHANGE Notification ()
Notifies a tab control's parent window that the currently selected tab has changed. This message is sent in the form of a WM_NOTIFY message.
-@SuDhIrKuMaR@-
|
|
|
|
|
The best way to use tab controls is to create your views on the fly depending on which tab is used. You can then create each view depending on the tab that was clicked. To show the views you can create them and move them to be the size of a static control you place in the tab control (I usually place a picture holder). Look at CWnd::Create() and CWnd::MoveWindow(). Remember, the Rectangle for the MoveWindow contains the dimensions of your static control.
|
|
|
|
|
can someone pls tel me how, i can read DATE and TIME field from MDB and display them into a List box. I can get string var displayed but not float var.
recset.Open(AFX_DAO_USE_DEFAULT_TYPE,"SELECT * FROM Bookings WHERE BookingDate = DATE()",NULL);
while(!recset.IsEOF()) // Do until EOF
{
int i = 0;
recset.GetFieldValue("Booking",Bookings);
Bookings = (LPCSTR)var.pbstrVal;
m_ShowBookings.SetItemText(0,1,Bookings);
i = i++;
recset.MoveNext();
}
recset.Close();
thank you
Gpat
|
|
|
|
|
Hi all,
I m using SDI type splitter application i want it is always show as maximize.
so i m using ShowWindow(SW_MAXIMIZE); in InitInstance() of .cpp file of application.
and in CMainFrame class in PreCreateWindow (CREATESTRUCT& cs)
function use this code.
cs.style = WS_OVERLAPPED|WS_SYSMENU |WS_MINIMIZEBOX|WS_BORDER;
return CFrameWnd::PreCreateWindow(cs);
Using of all, these the window is initially maximize,or the Maximize or Restore button is disabled but on double clicking on titlebor it is minimized.
How can disable the function of double clicking on Title bar.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Just Use this code.
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_NCLBUTTONDBLCLK)
return TRUE; // message handled or ignored
return CFrameWnd::PreTranslateMessage(pMsg);
}
-@SuDhIrKuMaR@-
|
|
|
|
|
Just add this to your PreCreateWindow (instead of what you show)
cs.style &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX);
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Hi all,
please tell me how can i m using print preview for SDI type splitter application.
How can i get print preview without Doc/View architecture for this type of application.
Please tell me .
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
void CTestForm::OnLvnKeydownList(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLVKEYDOWN pLVKeyDow = reinterpret_cast<LPNMLVKEYDOWN>(pNMHDR);
NMLVKEYDOWN* nmkd = (NMLVKEYDOWN*)pNMHDR;
switch(nmkd->wVKey)
{
case VK_SPACE:
int nIndex = GetNextItem(-1, LVNI_SELECTED);
CString strItem = GetItemText(nIndex, 0);
MessageBox("Test");
}
*pResult = 0;
}
i m using this function in FormView derived class and CDialog base class.
Here i m using a list and using this code for Space key fuction on the list.
This code is working fine for Dialog box but gives error"
Unhandled exception at 0x5d0f0892 in Demo.exe: 0xC0000094: Integer division by zero." for Formview please tell me any suggestion.
I m waiting for your valuable suggestions.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Use your debugger to see more in details what's happening there. Put breakpoints and inspect the values of the different variables.
|
|
|
|
|
i need some help to scale a 60*60 binary image to 100*100 binary image.
it is urgent.
shafaeat
|
|
|
|
|
Use GDI+ Bitmap::GetThumbnailImage()
|
|
|
|
|
|
Hint: there is a small link below my signature.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|