|
How can I be notified when the selection changes in a list ctrl with multiple selection? And if many items are selected, how can I know where the focused item is? That would correspond to the punctured rectangle (if that doesn't make sense try moving the selection with ctrl+up/ctrl+down, *not* up/down).
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
modified on Monday, September 28, 2009 11:18 AM
|
|
|
|
|
Have you looked at the LVN_ITEMCHANGED and LVN_ODSTATECHANGED notifications?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
What is the difference between LVN_ITEMCHANGED and LVN_ODSTATECHANGED? Also can you give me some help on using those functions?
void CMyDialog::OnOdstatechangedListFilenames(NMHDR* pNMHDR, LRESULT* pResult)
{
NMLVODSTATECHANGE* pStateChanged = (NMLVODSTATECHANGE*)pNMHDR;
*pResult = 0;
}
void CMyDialog::OnItemchangedListFilenames(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
*pResult = 0;
}
I have trouble figuring out how what those NM_LISTVIEW and NMLVODSTATECHANGE structures contain and how to glean from them whether an item has been selected/deselected.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
sashoalm wrote: What is the difference between LVN_ITEMCHANGED and LVN_ODSTATECHANGED?
The former is sent when an item has changed. The latter is sent when the state of an item or range of items has changed.
sashoalm wrote:
I have trouble figuring out how what those NM_LISTVIEW and NMLVODSTATECHANGE structures contain and how to glean from them whether an item has been selected/deselected.
MSDN is your friend.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Are there MAKEQWORD() , HIDWORD() , and LODWORD() macros in VS2005? I can make my own easy enough, but I wanted to use any standard/official ones if they existed.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
DavidCrow wrote: Are there MAKEQWORD(), HIDWORD(), and LODWORD() macros in VS2005?
Not any that I know of.
So now you can create and publish it.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I needed these recently myself. Searched through all files in VS distribution and couldn't find them.
Here is what I'm using:
#ifndef _QWORD_DEFINED
#define _QWORD_DEFINED
typedef __int64 QWORD, *LPQWORD;
#endif
#ifndef MAKEQWORD
#define MAKEQWORD(a, b) \
((QWORD)( ((QWORD) ((DWORD) (a))) << 32 | ((DWORD) (b))))
#define LODWORD(l) \
((DWORD)(l))
#define HIDWORD(l) \
((DWORD)(((QWORD)(l) >> 32) & 0xFFFFFFFF))
#endif
|
|
|
|
|
You can use the LARGE_INTEGER union and a little casting to accomplish everything those macros would do. There is also a ULARGE_INTEGER for unsigned use.
|
|
|
|
|
Hi,
I have following problem:
Suppose I have such class:
class NiceRectangle{
private:
Display dispHnd; //display handle
void DisplayRectangle(); // displays rectangle on screen
public:
unsigned int width; // dimensions
unsigned int height;
COLOR color; // interior color
unsigned int GetArea(); // return area
};
Is to it possible to perform some operations when I assign value to the width or height member.
Let`s say I write:
NiceRectangle nRect;
nRect.width = 100;
And when I assign 100 to nRect.width I want to perform instructions:
width = 100;
ShowDisplay(dispHand);
DrawFrame(width, height, Black);
...
and with
nect.height = 9;
I want to play a sound, open the fridge and finally assign 9 to height.
Another words, I want assigment operator = to act like function, but I want to be able to use it for any public member(variable).
I know it is possible to overload operator for a class, but I don`t want to overload an operator for a whole class, but only for its particular member.
I`ve heard about MFC which, I believe, performs similar tasks, but I want a more general solution, for example for linux.
Can this be done? How?
Thank You
|
|
|
|
|
In general, it is not good practice to make the members of your class public. In your specific case, it makes even more sense to make them private and provide getter and setter functions. In the setter function, you can them simply put any code you would like:
void NiceRectangle::SetWidth(unsigned newWidth)
{
width = newWidth;
}
On the other hand, I doubt that you would be able to open your fridge, I see some technical limitations here
|
|
|
|
|
It is a solution, but it os not very convenient.
I prefer the way it works in DELPHI. You change value of a property and change is instantly displayed.
|
|
|
|
|
Acutura wrote: It is a solution, but it os not very convenient.
Why ? This is how it should be done in C++.
Acutura wrote: You change value of a property and change is instantly displayed.
You have to make a separation between your "model" and your "view". In this case, it is much better to leave anything of refreshing or drawing out of your setter. Instead, you should refresh your "view" (which will probably in turn ask the figure to redraw itself).
I guess you are making a kind of drawing application in which you can draw rectangles ?
|
|
|
|
|
Acutura wrote: It is a solution, but it os not very convenient.
Why is it not convenient? Do you mean "I don't like it"?
Acutura wrote: I prefer the way it works in DELPHI. You change value of a property and change is instantly displayed.
Why bother?
Anyway, with a bit of extra work you may implement it in C++ , for instance (doggy details & error checking left as exercise )
class NiceRectangle;
class RectWidth
{
NiceRectangle * _pParent;
int _iWidth;
public:
RectWidth():_iWidth(0), _pParent(NULL){}
RectWidth (NiceRectangle * pParent):_pParent(pParent),_iWidth(0){}
RectWidth & operator = (int i);
operator int(){ return _iWidth;}
};
class NiceRectangle
{
public:
NiceRectangle():width(this){}
RectWidth width;
void OnWidthChange(){printf("new width is %d\n", (int) width);}
};
RectWidth & RectWidth::operator = (int i)
{
_iWidth = i;
_pParent->OnWidthChange();
return *this;
}
void main()
{
NiceRectangle nr;
nr.width = 100;
}
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]
|
|
|
|
|
That`s exactly what i needed!
But I don`t think I`ll use it. Just, too much writing. I`ll have to think about something else(it means, I won`t be using assigment operator).
Nevertheless, thanks
|
|
|
|
|
Acutura wrote: That`s exactly what i needed!
But I don`t think I`ll use it. Just, too much writing.
Well, some things built-in of other languages, must be coded in C++ (maybe amusing). I would go on the path suggested by Cédric.
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]
|
|
|
|
|
Acutura wrote: And when I assign 100 to nRect.width I want to perform instructions:
width = 100;
ShowDisplay(dispHand);
DrawFrame(width, height, Black);
Why do you want to fool your class consumer (maybe yourself)? Just make a method called:
NiceRectangle::UpdateTheGUIOnRectWidthChange(int iNewWidth)
{
}
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]
|
|
|
|
|
Hi, I have programmed a simple directshow audio player, a GUI application. I want it to select multiple files and play the subsequent files. But I am having problems using the functions FindFirstFile, FindFirstFile to search for the subsequent files. I have tried the way MSDN describes but it doesn't work (or I don't get it well). I have already included the flag that allows multiple file selection and I am able to select multiple files, but I find it difficult to use these functions to get subsequent files. I need help on how to use them, and if I can also get tutorials describing how to use these functions. Please help
|
|
|
|
|
Why do you need to post it again and again?
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]
|
|
|
|
|
Helo,
If i have a string" 21/jack", how can i let the program to distinguish numeric as age, and String as Name? :
for example , from name = jack , age = 21, how can do this ? if possible plz provide more usage of how to split String .
thx!
Thanks !
modified on Monday, September 28, 2009 8:52 AM
|
|
|
|
|
Since your request looks far from clear, could you please provide an input example (and the expected output)?
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]
|
|
|
|
|
You use CString::Tokenize[^] to split the string.
After you have split the string, convert each one into what you expect them to be (i.e. first one is the age, second is the name, ... )
M.
This signature was proudly tested on animals.
|
|
|
|
|
You may use CString::Tokenize [^] (or _tcstok [^] if you're not using MFC ) to split the string and then, for instance, _tcstol [^] to discover the actual type of the obtained strings.
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]
|
|
|
|
|
Hi, I have programmed a simple directshow audio player, a GUI application. I want it to select multiple files and play the subsequent files. But I am having problems using the functions FindFirstFile, FindFirstFile to search for the subsequent files. I have tried the way MSDN describes but it doesn't work (or I don't get it well). I have already included the flag that allows multiple file selection and I am able to select multiple files, but I find it difficult to use these functions to get subsequent files. I need help on how to use them, and if I can also get tutorials describing how to use these functions. Please help
|
|
|
|
|
What about documentation [^]?
Could you please post the failing code?
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]
|
|
|
|
|
Hi all,
i m developing an application for Pocket PC.
now i want to execute on pocket pc.
Please tell me how can make setup of my application and produce cab file.
please expalin me with any example if possible.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|