BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TComboBox::DropDown

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
JD
Guest





PostPosted: Tue Feb 10, 2004 1:19 am    Post subject: TComboBox::DropDown Reply with quote




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





PostPosted: Tue Feb 10, 2004 1:53 am    Post subject: Re: TComboBox::DropDown Reply with quote



"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





PostPosted: Wed Feb 11, 2004 7:56 pm    Post subject: Re: TComboBox::DropDown Reply with quote




"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





PostPosted: Wed Feb 11, 2004 9:30 pm    Post subject: Re: TComboBox::DropDown Reply with quote


"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





PostPosted: Thu Feb 12, 2004 12:57 am    Post subject: Re: TComboBox::DropDown Reply with quote


"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.