|
Thanks a'lot for your attention and your nice response.
|
|
|
|
|
I want to insert into a listview an item with an image :
BOOL CTestListImageView::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style |= LVS_REPORT;
return CListView::PreCreateWindow(cs);
}
and
void CTestListImageView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
CListCtrl& ListCtrl = GetListCtrl();
m_TraceImageList.Create(IDB_BITMAP_TRACEIL,16,1,ILC_MASK);
ListCtrl.SetImageList(&m_TraceImageList,TVSIL_NORMAL);
ListCtrl.InsertColumn(0, _T("Machine model"),LVCFMT_LEFT, 200);
ListCtrl.InsertColumn(1, _T("Description"), LVCFMT_LEFT, 250);
int nIndex = ListCtrl.InsertItem(0, _T("Test"),2);
ListCtrl.SetItemText(0,1, _T("aaaaaaaaaa"));
}
CTestListImageView class is derived from CLIstView, the m_TraceImageList data member is type of CImageList class, and have 10 images ...
still, the listview have not any image ( icon ) ... why ?
Why ? What I have do wrong ?
One mention : I prefer to insert an item with image with follow prototype :
int InsertItem( int nItem, LPCTSTR lpszItem, int nImage );
not with
int InsertItem( const LVITEM* pItem );
Thank you.
|
|
|
|
|
Flaviu2 wrote: m_TraceImageList.Create(IDB_BITMAP_TRACEIL,16,1,ILC_MASK);
Have you tried different values for the cx and nFlags parameters?
Flaviu2 wrote: ...the m_TraceImageList data member is type of CImageList class, and have 10 images ...
Where are those images being added?
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Sorry for delay :
DavidCrow wrote:
Flaviu2
wrote: m_TraceImageList.Create(IDB_BITMAP_TRACEIL,16,1,ILC_MASK);
Have you tried different
values for the cx and nFlags parameters?
I have try in follow ways :
m_TraceImageList.Create(IDB_BITMAP_TRACEIL,16,1,ILC_COLOR);
m_TraceImageList.Create(IDB_BITMAP_TRACEIL,16,1,ILC_MASK);
m_TraceImageList.Create(IDB_BITMAP_TRACEIL,16,1,ILC_COLOR | ILC_MASK);
m_TraceImageList.Create(IDB_BITMAP_TRACEIL,16,2,ILC_COLOR | ILC_MASK);
m_TraceImageList.Create(IDB_BITMAP_TRACEIL,16,1,ILC_COLOR8 | ILC_MASK);
but un vain ...
DavidCrow wrote:
Flaviu2 wrote: ...the m_TraceImageList data member is type
of CImageList class, and have 10 images ...
Where
are those images being added ?
these iages are into an bitmap resource, IDB_BITMAP_TRACEIL
named ... I use the same technique for an treeview and goes well ...
|
|
|
|
|
Have you tried using LVSIL_SMALL when setting the image list?
If you vote me down, my score will only get lower
|
|
|
|
|
Also TVSIL_NORMAL is a tree control image list style flag, you would need LVSIL_NORMAL. the values may be different.
If you vote me down, my score will only get lower
|
|
|
|
|
Now it goes with TVSIL_SMALL .. thank you all.
|
|
|
|
|
Hi
I want to show a modeless dialog (in a SDI project) that I can use it when any other modal dialog of project is open.
I set the always on top style so I can see it when any other project's modal dialog is open, but I can't use it. I must close the modal dialog first and after that I can use my first dialog(modeless).
I set the parent window to CMainFrame and then NULL, but both ways did not work fine.
Also I tested some other styles, but found nothing.
Is there any way to do this?
www.logicsims.ir
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">Hadi Dayvary wrote:</div>...but I can't use it.</blockquote>
Why? What's the problem? Does it show but can't be interacted with? Does it show but stays in the background? Does it fail to show? How, and when, are you displaying it?
<blockquote class="FQ"><div class="FQA">Hadi Dayvary wrote:</div>I must close the modal dialog first and after that I can use my first dialog(modeless).<BR></blockquote>
This sounds like normal behavior of a modal dialog.
<p align="right"><small>"One man's wage rise is another man's price increase." - Harold Wilson<br /><br />"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<br /><br />"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous</small></p>
-- modified 8-Nov-11 10:42am.
|
|
|
|
|
it's shown but can't be interacted with.
I have created it in CMainFrame::OnCreate()
like this :
m_dlgCalling.Create(IDD_CALLING, NULL);
m_dlgCalling.ShowWindow(SW_SHOW);
or this:
m_dlgCalling.Create(IDD_CALLING, this);
m_dlgCalling.ShowWindow(SW_SHOW);
www.logicsims.ir
|
|
|
|
|
So you are creating and showing the modeless dialog during the creation of the main frame, correct? Where does the modal dialog play into this?
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
modal dialogs come when user selects an item from the menu.
www.logicsims.ir
|
|
|
|
|
And by definition, modal dialogs must be dismissed before you can interact with any windows behind them.
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I know, but I must do this for our project,
There must be a way to do something like this.
www.logicsims.ir
|
|
|
|
|
You can always create the modeless dialog via it's own UI thread. The issue is the modal dialog is preventing pumping of your messages.
onwards and upwards...
|
|
|
|
|
thanks.
Do you mean that I must create create a thread and then craeting the modeless dialog from that?
www.logicsims.ir
|
|
|
|
|
Hi There ,
I am stuck with this problem since weeks. Apparently I am new to Visual Studio. I have a client dll which exposes some APIs . I am supposed to create a C++ Unit Test project in Visual Studio 2005 and test the methods in the dll. Unfortunately I am not able to invoke the methods , I often get linking errors such as
"error lnk2031: unable to generate p/invoke for"
The .h file has some function exports .I am pasting part of the .h file here
//.h file starts
#ifdef ITMENTITLEMENTWRAPPER_EXPORTS
#define ITMENTITLEMENTWRAPPER_API __declspec(dllexport)
#else
#define ITMENTITLEMENTWRAPPER_API __declspec(dllimport)
#endif
// This class is exported from the itmEntitlementWrapper.dll
class ITMENTITLEMENTWRAPPER_API CitmEntitlementWrapper {
public:
CitmEntitlementWrapper(void);
// TODO: add your methods here.
};
extern ITMENTITLEMENTWRAPPER_API int nitmEntitlementWrapper;
ITMENTITLEMENTWRAPPER_API EINSTALLTYPE fnGetInstallType(const wchar_t * InstallType);
ITMENTITLEMENTWRAPPER_API int vm_wstrcmp(const wchar_t* s1, const wchar_t* s2);
extern "C"
{
/**
* fnitmEntitlementWrapper_ENTITLE_INST_FIRST - The purpose of this method is to load the caEntitlement.dll*/
ITMENTITLEMENTWRAPPER_API BOOL fnitmEntitlementWrapper_ENTITLE_INST_FIRST(const wchar_t *eProductID = L"eProductNone",
const wchar_t *ePackageID = L"ePackageNone", HWND hWndParent = NULL);
//.h file ends
How am I supposed to call these methods in UnitTest.cpp. I am adding a dll reference to the Testing project and also tried to use DLLimport . Can anyone please help.
Thanks
Diya
|
|
|
|
|
See the suggestion here[^].
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I first saw this technique in the stl where collections return
std::pair<iterator, bool> from their insert method. The bool indicating if the item was inserted or already existed.
Personally I dislike this, I find the names first and second which identify the pair's elements very misleading and find I'm constantly having to look at doco to see what something is. The worst case I've seen was along the lines of
pair<bool, pair<bool, bool> . How could anyone be expected to remember what result.second.first is?
I prefer to pass in a reference to a variable
eg
iterator map::insert(iterator position, const value_type& x, bool& wasAdded)
This has the disadvantage that the caller has to allocate a bool and pass it in even if they're not interested in the result (this can be overcome by using a pointer with default value of NULL but that's also ugly)
I blame python and its tuples for this outrage. What do others think?
|
|
|
|
|
Well, as long as we're talking about personal preferences.
I think that templates, in general, has uglied up the language by spraying < and > all over the place. I think somebody went nuts with this stuff and talked the language committee into using it. Plus the fact that it's not just the template definition that's affected but the coder has to use that syntax when referencing it had contributed to the unreadability of code.
I mean > is already used in pointer use (->) and in inequality tests (greater than) and then there's the right shift (>>) operator. Then somebody comes along to overload it for "cin" and other stream io. And don't get me started on <
I mean really, try writing code that takes some template result as a pointer to an object that you want to stream data into. Count the >'s. If they were right parens ) instead, it would remind me of early Lisp.
|
|
|
|
|
Chuck O'Toole wrote: I think that templates, in general, has uglied up the language by
spraying < and > all over the place.
True, C++ is now almost unreadable due to templates.
==============================
Nothing to say.
|
|
|
|
|
That's c for you though.'&' is similarly overused.
pair<int, pair<int, int>>
confuses most compilers, you need
pair<int, pair<int, int> >
|
|
|
|
|
typedef pair<int, int> IntPair;
typedef pait<int, IntPair> IntIntPair;
Won't this makes your life simpler?
|
|
|
|
|
Yeah, I always thought the same about templates... make everything hard to read.
|
|
|
|
|
_Josh_ wrote: What do others think?
Rich syntax has nothing to do with maintainable code.
"Clever" coding tricks demonstrates that one has mastered a language while at the same time demonstrating that one hasn't mastered software development (which of course includes much more than just producing code.0
|
|
|
|