|
Hi everyone! I have problem using list control in visual c++. I tried to create a table which appears on a dialog window but when I run the executable on dialog appears only an empty "window" without the data I wrote. I used the "report view". Here is the code:
void CDataDialog::OnLvnItemchangedStoreItems(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
*pResult = 0;
m_StoreItems.InsertColumn(
0,
L"ID",
LVCFMT_LEFT,
100);
m_StoreItems.InsertColumn(1, L"Resistivity", LVCFMT_CENTER, 80);
m_StoreItems.InsertColumn(2, L"Permeability", LVCFMT_LEFT, 100);
m_StoreItems.InsertColumn(3, L"Rdc", LVCFMT_LEFT, 80);
int nItem;
nItem = m_StoreItems.InsertItem(0, L"1");
m_StoreItems.SetItemText(nItem, 1, L"0.000869");
m_StoreItems.SetItemText(nItem, 2, L"1");
m_StoreItems.SetItemText(nItem, 3, L"0.09136");
nItem = m_StoreItems.InsertItem(0, L"2");
m_StoreItems.SetItemText(nItem, 1, L"0.0008603");
m_StoreItems.SetItemText(nItem, 2, L"1");
m_StoreItems.SetItemText(nItem, 3, L"0.09136");
nItem = m_StoreItems.InsertItem(0, L"3");
m_StoreItems.SetItemText(nItem, 1, L"0.000869");
m_StoreItems.SetItemText(nItem, 2, L"1");
m_StoreItems.SetItemText(nItem, 3, L"0.09136");
}
void CInputView::OnLinefeaturesData()
{
CInputDoc* pDoc = GetDocument();
CDataDialog DialogWindow;
DialogWindow.DoModal();
}
|
|
|
|
|
OnLvnItemchangedStoreItems seems to be a LVN_ITEMCHANGED notification code (Windows)[^] handler. That is called whenever an item of a list control is changed but you are trying to create columns and add items there. But that handler is never called while you are not adding and changing items (and will produce a stack overflow or dead lock when adding items from within the handler).
Move the code from the handler to CDataDialog::OnInitDialog . That will populate the list and show it.
|
|
|
|
|
Thank you very much sir!!It worked!!!
|
|
|
|
|
I have one dialog without border
and on it i have one picture control
I wanted to move the window using picture control like we are moving using title bar
|
|
|
|
|
Exactly what do you want to move, and how? Do you want to move the picture within the dialog using the mouse, or some other feature? Or do you want to move the entire dialog?
|
|
|
|
|
Entire Dialog I want to move
|
|
|
|
|
|
See if this helps.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 11-Mar-17 10:20am.
|
|
|
|
|
Indeed.
You simply needs to return HTCAPTION on the WM_NCHITTEST message. Which is OnNcHitTest in the MFC framework.
Best Wishes,
-David Delaune
|
|
|
|
|
You need to process the mouse messages in your dialog, you have to do all the work because you don't have a frame.
Usually you have a select trigger, lets say that is left mouse click down (WM_LBUTTONDOWN) that sets a flag in your dialog handler.
When that flag is set you process WM_MOUSEMOVE messages to actually move the the window with the mouse.
Then you have a trigger to release, lets say that is left mouse button up (WM_LBUTTONUP) that clears the flag in your dialog handler.
You can confine the triggers to areas on your dialog or the whole dialog just by looking at position of the trigger messages and allowing or ignoring.
That is what the frame handler does and why you can't drag the dialog around without the frame. It also has triggers on the keys to allow you to size and move the window by the keys. The normal frame handler has special areas that turn triggers on/off the top bar allows dragging, the bottom right allows X,Y sizing the sides one direction sizing etc.
On MDI and SDI's they call a global default handler called DefFrameProc with some structures, you can look it up on MSDN. That should give you the detail of what you need to do if you want to complete implementation.
For graphical dragging and the like I only ever do the basic mouse one.
In vino veritas
modified 10-Mar-17 22:32pm.
|
|
|
|
|
Hi
I just used SnagIt Screen Capture to go over window pane by window pane of both the compiler options for debug and release and the only debug and release version
is the run time library 1) release its Multi threaded DLL /MD while in Debug its debug DLL /MDd
However I keep on getting different compile errors
at one point I had a clean build for Debug while Release was giving me errors
|
|
|
|
|
ForNow wrote: ...while Release was giving me errors And those would be?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
mainly with CString.Format (I was using it like the C sprintf) and it looked for const wchar_t * for the format string. The Doc says the string is of type LPCTSTR
I am working on Release when I get a clean build from Release I should have no problem
with Debug I hope
Thanks
|
|
|
|
|
Well we still have no real idea what your problem is.
|
|
|
|
|
|
Well he is 'mercan
|
|
|
|
|
Really? His sentence structure was more that of a Mandarin speaker using bad English.
|
|
|
|
|
|
LPCTSTR = Long Pointer to Const Tchar STRing
This will be const wchar_t * for Unicode builds and const char * for ANSI/multi-byte builds.
|
|
|
|
|
|
This has nothing to do with compiler options, per se. Use the _T() macro for the format string.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
ForNow wrote: mainly with CString.Format (I was using it like the C sprintf) and it looked for const wchar_t * for the format string
Please, next time show the exact error message together with a line (or a couple of lines) causing the error.
|
|
|
|
|
I have downloaded and installed ImageMagick++ from http://www.imagemagick.org/Magick++/.
I am using Windows7 32 bit and Visual Studio 2008. I want to use the ImageMagick in an existing project. I made the required/suggested changes to my project properties like adding dependencies etc. I added three libraries in the additional dependencies (CORE_RL_Magick++_.lib,CORE_RL_MagickCore_.lib and CORE_RL_MagickWand_.lib
I added
Magick++.h header file and
using namespace Magick
Then
Magick:: Image image (No error)
image.read("5.png") throws an error "ErrorMissingDelegate at memorry location ....".
I tried other image formats also, but same error.
Please help.
|
|
|
|
|
|
Thanks for the reply.
The complete message is Magick::ErrorMissingDelegate at memory location 0x0012fafc.
I can understand there are some missing delegates but I really do not understand how do I have to install them.
Regards
|
|
|
|