| View previous topic :: View next topic |
| Author |
Message |
JD Guest
|
Posted: Tue Feb 10, 2004 1:19 am Post subject: TComboBox::DropDown |
|
|
It is possible to selectively prevent a ComboBox from dropping
down when the down-arrow is clicked?
~ JD
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Feb 10, 2004 1:53 am Post subject: Re: TComboBox::DropDown |
|
|
"JD" <nospam (AT) nospam (DOT) com> wrote
| Quote: | It is possible to selectively prevent a ComboBox from
dropping down when the down-arrow is clicked?
|
The closest I can figure out is to subclass the ComboBox to intercept the
CN_COMMAND message and prevent it from processing CBN_DROPDOWN
notifications. For example:
TWndMethod OldWndProc;
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
OldWndProc = ComboBox1->WindowProc;
ComboBox1->WindowProc = ComboBoxWndProc;
}
void __fastcall TForm1::ComboBoxWndProc(TMessage &Message)
{
if( (Message.Msg == CN_COMMAND) && (HIWORD(Message.WParam) ==
CBN_DROPDOWN) )
return;
OldWndProc(Message);
}
Gambit
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Wed Feb 11, 2004 7:56 pm Post subject: Re: TComboBox::DropDown |
|
|
"Remy Lebeau (TeamB)" <gambit47.no.spam (AT) no (DOT) spam.yahoo.com> wrote:
| Quote: | The closest I can figure out is to subclass the ComboBox to intercept the
CN_COMMAND message and prevent it from processing CBN_DROPDOWN
notifications. For example: [...]
|
I had too many objects to just subclass the WndProc so I
derived a new class and overrode it instead.
It worked (sorta) for a couple of clicks but the bottom border
of the drop down area appeared just under the control.
With succeeding clicks, the control vanished from the screen.
I didn't try anything like BringToFront to see if it was still
around and it didn't cause and AV's or Exceptions but I also
didn't try any of it's methods after is vanished.
I was just experimenting with possibilities so I'm not going
to look at it further (for now) but thanks anyway for your
time.
~ JD
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Feb 11, 2004 9:30 pm Post subject: Re: TComboBox::DropDown |
|
|
"JD" <nospam (AT) nospam (DOT) com> wrote
| Quote: | It worked (sorta) for a couple of clicks but the bottom
border of the drop down area appeared just under the control.
|
I didn't say it was a perfect solution, just the closest one I could find so
far.
Gambit
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Thu Feb 12, 2004 12:57 am Post subject: Re: TComboBox::DropDown |
|
|
"Remy Lebeau (TeamB)" <gambit47.no.spam (AT) no (DOT) spam.yahoo.com> wrote:
| Quote: | I didn't say it was a perfect solution [...]
|
What? Did hell just freeze over? <g>
~ JD
|
|
| Back to top |
|
 |
|