|
Hello,
In my MFC application, I am having a problem with my listview's items. They don't show. It looks like they are there because when they load the scroll bars appear.
The following code is OnCreate() where I Initialize the listView:
int CTopRightView::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
if (CView::OnCreate(lpCreateStruct) == -1)<br />
return -1;<br />
<br />
SetWindowLong(GetListCtrl().m_hWnd, GWL_STYLE,<br />
WS_VISIBLE|WS_CHILD|LVS_LIST);<br />
<br />
COLORREF c = PALETTERGB(200, 70, 130);<br />
GetListCtrl().SetBkColor(c);<br />
<br />
smallImageList.Create(16,16,false,1,0);<br />
<br />
HICON hIcon = ::LoadIcon(AfxGetResourceHandle(), <br />
MAKEINTRESOURCE(IDI_ICON3));<br />
smallImageList.Add(hIcon);<br />
<br />
GetListCtrl().SetImageList(&smallImageList, LVSIL_SMALL);<br />
<br />
return 0;<br />
}
And this piece of code adds an item to the listview:
<br />
LV_ITEM lvItem;<br />
::memset(&lvItem, 0, sizeof(LV_ITEM));<br />
lvItem.mask = LVIF_TEXT|LVIF_IMAGE|LVIF_STATE;<br />
lvItem.state = 0;<br />
lvItem.stateMask = 0;<br />
lvItem.pszText = GetNTS(GetDocument()->fileName);<br />
lvItem.iItem = GetDocument()->fileCount;<br />
lvItem.iImage = 0;<br />
<br />
GetListCtrl().InsertItem(&lvItem);
Anybody might know what I am doing wrong?
TraileR ParK LifE 4Ever
|
|
|
|
|
/* Trucker */ wrote:
SetWindowLong(GetListCtrl().m_hWnd, GWL_STYLE,
WS_VISIBLE|WS_CHILD|LVS_LIST);
There's a much simpler way to do this, and you only have to do it once:
BOOL CTopRightView::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style |= LVS_LIST;
return CListView::PreCreateWindow(cs);
} What does InsertItem() return?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi David,
InsertItem() returns a positive value if successful or -1 otherwise.
TraileR ParK LifE 4Ever
|
|
|
|
|
So is it returning -1 in this case, or is it returning a positive value yet the items still do not show up?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
it is returning a positive value but the items still do not show up.
TraileR ParK LifE 4Ever
|
|
|
|
|
I want to show multiline text in my dialog.
I have some conditions.
. If the number of lines is three or less it should come the center of the dialog vertically.
. If it exceeds 3 lines, 3 lines should appear to the user and a vertical scrollbar should come to view the remaining lines by scrolling down.
Which control should I use for the best result?
The text will be unicode format.
Thanks for suggestions.
- NS -
|
|
|
|
|
EditBox (CEdit in MFC), created with the multiline flag...
see the properties box in design mode into Visual Studio
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Is there any method to get the line height in EditBox?
|
|
|
|
|
line height ?
you want to count 3 lines or what ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I have an idea to dynamically set the window pos to center.
If I have the line height then can calculate the window pos.
And also set the visible line count to 3.
|
|
|
|
|
Nishad S wrote:
I have an idea to dynamically set the window pos to center.
If you are wanting to center the actual edit control within its parent, you'll need to use MoveWindow() or SetWindowPos() . If you are using MFC, check out the CWnd::CenterWindow() method.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
This sounds like an owner drawn control to me, unless the richedit box has a property to centre the text.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i guess u want m_Text.LineLength() ??
V
|
|
|
|
|
You can use MFC CEdit::GetLineCount() or the Win32 Message EM_GETLINECOUNT to get the number of lines.
--> . If the number of lines is three or less it should come the center of the dialog vertically.
I can't understand your question properly. do you meant to say if the number of lines are 3 or less, you don't want any scrollbar?
" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "
- Words from Nelson Mandela
Thanks & Regards,
Gopalakrishnan
|
|
|
|
|
It sounds like you need to use the ES_CENTER and ES_MULTILINE styles.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hello there guys.
Using VC++/MFC, I successfully created a new html file, but when the application was launch, an empty window appeared. The html created didn't display on that window.
For more details:
Inside of the MyAppView.cpp ::OnInitialUpdate(), a function is called that will create a html file(for e.g. CreateHtml("./test.htm") )where "test.htm" is the htm file created. Then Displaying the html using Navigate("file://..../test.htm"); I'm wondering why the window is empty. I check the test.htm file created and it's not empty. I also tried Navigate2("file://...../menu.htm") and still empty window was display...
Also, I tried passing it to an existing URL like "http://www.codeproject.com" and there's no problem with it.
I'd like to ask if I miss something there?. Is there's a way that the created html file is the display on the window?
Thanks..
With great power comes a great responsibility.
|
|
|
|
|
I have re-created another project that had similar functions. It worked correctly.
Please, try to open created HTML files by IE to check whether that files display well or not.
Contact me if you want to get a working sample project by email.
|
|
|
|
|
Thanks for the reply.
I already try to open the created HTML files by IE and also by Mozilla and it display fine. That's why I'm wondering how I can deal with it.
Please... please... help me with this matter.
How can I contact you?
Thanks a lot....
With great power comes a great responsibility.
|
|
|
|
|
Hello Friends
I have developed an application in which I want to play my *.WAV, *.MP3 or any other audio file.
How to achieve this ? Any example ?
Regards,
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
Embedd the Windows Media Player in your app or use DirectShow.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Is it possible to view the Japanese text in the dialog box editor itself?
|
|
|
|
|
Try to use APPWZJPN.DLL for your project. Menubars, Dialogs, etc. will display in Japanase. If APPWZJPN.DLL is not existed in your "Microsoft Visual Studio\Common\MSDev98\Bin\IDE" folder, copy it from the CD installer of Visual C++. Or just google it and put it on that folder.
Hope it will helps.
With great power comes a great responsibility.
|
|
|
|
|
Ok. I will try in that way.
Thanks for your suggestion.
|
|
|
|
|
Hello All,
How can I give mulitlingual support to my dialogs?
Thank you.
- NS -
|
|
|
|
|