|
I could be wrong, but I do not think that the standard List Box control supports lines. The List View control does.
Doing some custom drawing might be a way to get you some lines. There are a few custom-drawn List Box controls on this site you can search for and use as a starting point.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
How can disable an item of context popup menu ?
|
|
|
|
|
EnableMenuItem doesnt work?
|
|
|
|
|
Are you using MFC?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
how to change scroll bar's color of list box?
Ajit
|
|
|
|
|
I think you cant change color scrollbar of listbox but you can hide main scrollbar and use of your scrollbar see this[^] maybe it some helpfuls
|
|
|
|
|
Hi anyone can help?
How can we detect enter Key pressed in MFC/C++ created by CHTMLEDITVIEW.
ie. When i run my application, I will go to FILE->OPEN->name.ppt
The "name.ppt" (powerpoint slide) will be open.
When i pressed the ENTER key, it does not capture it.
Why?
I used PretranslateMessage()... It doesnt work.
anyone can help?
terr
|
|
|
|
|
Hi everyone,
by sizing the MDI-Child the textboxes are getting ugly ( double border & pieces of the border in the textbox )
At the End of the sizing ( WM_EXITSIZEMOVE ) i make a :
this->RedrawWindow();
this->Invalidate();
this->UpdateWindow();
RedrawControls(); // --> makes a .Invalidate() of all textboxes and labels
but the textboxes keeps ugly.
If i open another window ( f.ex. Explorer ) and i return on my application, all is refreshed nicely.
So, there is a "Refresh" that redraws all. But how can i perform this kind of refresh myself ?
Big thanks
|
|
|
|
|
baerten wrote: this->RedrawWindow();
call the redrawfunction specifing the RDW_ALLCHILDREN flag
nave
|
|
|
|
|
Thanks for your answer, but it resolves not the problem.
If i slide another MDIChild over the View with the "ugly" textboxes, they will be refreshed correctly.
-- modified at 5:10 Wednesday 20th December, 2006
A SetRedraw(FALSE) during the Sizing provoces this problem. Even with a SetRedraw(TRUE) at the end of
the OnSize-Method the following Invalidate() and RedrawWindow() does not refresh the entire textbox
But thanks nevertheless
|
|
|
|
|
Why do you need to do so many redraws at the end of a resize or move?
What happens if you don't handle WM_EXITSIZEMOVE and let the system handle it?
At the most you should need
this->Invalidate(FALSE);
this->UpdateWindow();
If the controls are children of the window being updated then they will be redrawn as well.
|
|
|
|
|
I have problem in displaying the tooltip.
In the header file of the Dialog,I declare the message handler as
<br />
afx_msg BOOL ShowMyToolTips(UINT id, NMHDR* pTTTStruct, LRESULT* pResult);<br />
In the .cpp file of the Dialog,
<br />
BEGIN_MESSAGE_MAP(CSimpleToolTipDlg, CDialog)<br />
... <br />
ON_NOTIFY_EX(TTN_NEEDTEXT,0,ShowMyToolTips) <br />
END_MESSAGE_MAP()<br />
In the OnInitDialog
<br />
BOOL CSimpleToolTipDlg::OnInitDialog()<br />
{<br />
...<br />
EnableToolTips(true);
return TRUE; <br />
}<br />
Then the definition of the message handler
<br />
BOOL CSimpleToolTipDlg::ShowMyToolTips(UINT id, NMHDR* pNMHDR, LRESULT* pResult)<br />
{<br />
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT*)pNMHDR;<br />
UINT nID = pNMHDR->idFrom;<br />
if(pTTT->uFlags & TTF_IDISHWND)<br />
{<br />
nID = ::GetDlgCtrlID((HWND)nID);<br />
if(nID)<br />
{<br />
pTTT->lpszText = "I am a ToolTip";
pTTT->hinst = AfxGetResourceHandle();<br />
return(TRUE);<br />
}<br />
}<br />
return(FALSE);<br />
}<br />
The big problem is,ShowMyToolTips() function is not called at all.
I even tried
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, ShowMyToolTips)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, ShowMyToolTips)
But it also does not work.
Do any one know what's wrong.
|
|
|
|
|
overide the OnNotify function and inside it check for the code TTN_NEEDTEXT
nave
|
|
|
|
|
You are great man!
It works fine,if I just override OnNotify function without
adding any code in it.
If you know the reason why it does not work if OnNotify
was not overridden,let me also know that.
Thank you so much.
|
|
|
|
|
poda123 wrote: I just override OnNotify
u didn't write any code inside it?
nave
|
|
|
|
|
Yes, I did not write any code in OnNotify().But it works.
Also I cannot write the code of TTN_NEEDTEXT message handler's code
in OnNotify() function because the parameters has to be given by the OS
<br />
BOOL CWFPDlg::ShowMyToolTips(UINT id, NMHDR* pNMHDR, LRESULT* pResult)<br />
{<br />
}<br />
|
|
|
|
|
u can d like this.
BOOL CWFPDlg::ShowMyToolTips(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
{
if( pNMHDR->code == TTN_NEEDTEXT)
{
// u r code...
}
}
any way now it working na..
where r u from?
nave
|
|
|
|
|
You suggested me to write the ShowMyToolTips() function code in
OnNotify() function.
Since the parameters such as NMDHR* has to be given by OS,I cannot write it
in overridden OnNotify() function.
ShowMyToolTips() function is the Message Handler for the Message TTN_NEEDTEXT.
So again why should I check like
if( pNMHDR->code == TTN_NEEDTEXT)
{
// u r code...
}
Thanks for your reply.
I am from Chennai,India.
|
|
|
|
|
Hello all
I compile my application in unicode. I make all settings related to unicode, but error occure as
static_cast' : cannot convert from 'class CString' to 'const char *const '
so plz send me solution of this if anybody know.
Thanks
Atool
Atool
|
|
|
|
|
it cant convert but u can use CString GetBuffer
never say die
|
|
|
|
|
void foo(const char*);
CString str = _T("hello");
foo((LPCTSTR)str);
|
|
|
|
|
I think that arose because of, when using UNICODE, the operator LPCTSTR ( ) const casts to const WCHAR * instead of const char * .
So all that you can do is
const WCHAR * pWChar = (LPCTSTR)yourString;
If you need a char pointer then you have to convert the wide-char string to the ANSI one, perhaps calling WideCharToMultiByte API (see MSDN for reference) on the obtained wchar pointer.
hope that helps.
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.
|
|
|
|
|
'static_cast' : cannot convert from 'CString' to 'wchar_t *'.Toxcct is right as i didnot see that the querier wants to convert to const char*:->
never say die
|
|
|
|
|
Actually I wrote 'const wchar_t * '
The code below
CString str("foo");
const wchar_t * pWStr = (LPCTSTR) str;
works fine. But then you have to convert the string if your final target is to obtain a const char * pointer.
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.
|
|
|
|
|
CPallini wrote: const wchar_t * pWStr = (LPCTSTR) str;
this is faulty, because you convert a string of TCHARs into a string of wchar_t.
change into this :
const wchar_t * pWStr = T2WC((LPCTSTR) str);
|
|
|
|