|
Hello, there,
I am currently working on a project. There is a combo box. I'd like to know how I can disable the dropdown arrow of it or hide the dropdown arrow. In my project there is two setting, one is keeping the input history, one is not keeping the input history.
I tried m_Combo.ShowDropDown(false)when not keeping the history, but there is a black line under it and it doesn't look good. Is there a way to solve this problem?
Thanks a lot in advance.
Bin
|
|
|
|
|
One way is to subclass the control, and handle WM_LBUTTONDOWN yourself, to effectively disable it that way, or alternatively, at run-time create an edit control in it's place which is ES_READONLY.
Steve S
|
|
|
|
|
If your wanting to disable it do this
have a combo box and give it a control name like m_example
then on your button or whatever your using
lets say your using a button and the button is called History
you put under OnHistory()
m_example.EnableWindow(FALSE); // disabled combobox or whatever linked to
m_example.EnableWindow(TRUE); // enables combobox or whatever linked to
now if you wanna hide it all together
i would do this under the OnHistory()
m_example.ShowWindow(SW_HIDE); // hides the combobox or whatever linked to
if you want the window back then
m_example.ShowWindow(SW_SHOW);// shows the combobox or whatever linked to
GOOD LUCK,
HOPE THIS HELPS.
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
thanks a lot. But I just want to disable the drop down button and make it work as an edit box. I don't want to disable the whole thing.
Thanks.
|
|
|
|
|
what you can do is:
Just iterate the windows of the combo box. Combo box contains the edit box and the button.
For example
char szClassName[256];
CWnd* pWnd=(CWnd *)m_combo.GetWindow(GW_CHILD);
::GetClassName(pWnd->GetSafeHwnd(), szClassName, 256);
while( strcmp( szClassName,_T("Button")) != 0 )
{
pWnd=(CWnd *)m_combo.GetWindow(GW_HWNDNEXT);
}
//Got the button
if( pWnd )
pWnd->ShowWindow( SW_HIDE );
|
|
|
|
|
Thanks alot, very helpful hint!!
|
|
|
|
|
I have seen issues with something that works fine in all Windows OS's except some machines running 2000 or XP. I'm using a WM_COPYDATA to send text between windows. When it fails, messages that should appear do not. It is extremely hard to narrow it down further than that.
Is anyone aware of any issues using this message on the newer OS's?
|
|
|
|
|
Does it fail consistently? Have you used Spy++ on the recipient window to see if it is receiving the message?
Perhaps the author of this article might have some knowledge of it failing.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Well, I've looked into it a bit further. It is actually recieving the message but the pointer to the data seems to be off be quite a bit (haven't counted the offset yet). I can see the start of my struct in the dump but it is preceeded by a bunch of "junk". I really don't know why. I have one long and 2 int's followed by a char[256]. The long, int's and string are all in there but not at the correct starting point.
Any ideas?
|
|
|
|
|
Dave_ wrote:
Any ideas?
Having not ever used that message before, I'm afraid not.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I noticed someone else mentioned a similar issue in the article you linked to. No answer posted unfortunately.
|
|
|
|
|
It appears that the author has not been good about answering any of them. Bummer.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi,
I saw a thread where wm_copydata failed due to the nvidia tray-icon app.
MfG
|
|
|
|
|
Ok, but since Dave_ was the one asking the question, you might want to respond to him.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Help, please!
How to access a member in a base class from within an __asm block?
Suppose, we have:
struct s1
{
int a;
};
struct s2 : s1
{
int b;
};
struct s3
{
s2 c;
};
then:
__asm mov eax, [eax]s3.c.b // just fine
but
__asm mov eax, [eax]s3.c.a // ERROR
|
|
|
|
|
Use this instead:
__asm mov eax, [eax]s3.c.b.a
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Yes, this works! Why, however this doesn't:
struct s2 : POINT
{
int b;
};
struct s3
{
int c;
};
__asm mov eax, [eax]s3.c.b.x // 'x' : ambiguous member name in 'second operand'
'x' couldn't be a reserved name, could it??
Is there any way to clarify it to compiler except for defining an offset explicitly, like:
enum { s3s2x = offsetof(s3, s2.x) };
and then
__asm mov eax, [eax + s3s2x]
|
|
|
|
|
How are you expecting to get to 'b' or 'x' through struct s3 since struct s3 and struct s2 know nothing of each other?
__asm mov eax, [eax]s3.c.b.x
^ this dot makes no sense
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Sorry, of course:
struct s2 : POINT
{
int b;
};
struct s3
{
s2 c;
};
__asm mov [eax]s3.c.b.x // error
__asm mov [eax]s3.c.x // error also
And, unfortunately, if s2 has no data members,
that is
struct s2 : POINT
{
void foo();
};
then I wouldn't know how to access POINT::x at all as
__asm mov [eax]s3.c.x
results in error again...
|
|
|
|
|
See if this helps:
int xx = ss3.c.x;
__asm mov eax, [eax][xx]
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Well,
enum
{
s3cx = offsetof(s3, c.x)
};
__asm mov eax, [eax + s3cx]
is better as it requires no additional code, but the point was to access it from within an __asm block with no helpers...
Take a look at this:
struct POINT3
{
int x;
int y;
int z;
};
struct s2 : POINT3
{
int b;
};
struct s3
{
s2 c;
};
Now,
__asm mov eax, [eax]s3.c.b.z // works fine
but
__asm mov eax, [eax]s3.c.b.x // doesn't!!
That's why I asked if 'x' was reserved or smth...
However, if s2 is
struct s2 : POINT3
{
void foo();
};
then
__asm mov eax, [eax]s3.c.z // fails too...
Any suggestions will be greatly appreciated and thanks for your input!
|
|
|
|
|
jk61 wrote:
Now,
__asm mov eax, [eax]s3.c.b.z // works fine
Why this does not yield a compiler error is odd, as 'b' cannot be resolved into anything further as it is an int type. Does that make sense? When you have . and -> notation, it means that the object (i.e., structs and classes) can be broken down even further.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Yes, it would be odd if it was C++ code, but for inline asm it's sort of normal, I suppose.
You suggested that syntax yourself, right? It didn't even cross my mind to try to access 'x' through 'b'. Do you have a ms vc compiler there to try it out?
|
|
|
|
|
jk61 wrote:
You suggested that syntax yourself, right?
Indeed I did. Shame on me!
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I give up... That strange access, while compiles ok, results, in fact, in wrong offsets... So, it doesn't work after all and I go with enums
|
|
|
|