473,799 Members | 3,329 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.Net combo box - what is "opposite" of DropDown event?

I'm working on an owner-drawn combo box which has extended
functionality. I have to do something to the dropdown list when it
drops down, then undo it when it is closed up again. But I can't see
an event which seems to be a "CloseUp" event - is there such an event?
Surely there must be!

Aug 8 '06 #1
4 2521
Steve Marshall wrote:
I'm working on an owner-drawn combo box which has extended
functionality. I have to do something to the dropdown list when it
drops down, then undo it when it is closed up again. But I can't see
an event which seems to be a "CloseUp" event - is there such an event?
Surely there must be!
..NET 2.0: DropDownClosed
Earlier: Override the WndProc message and watch for message
CB_SHOWDROPDOWN (this same message is sent on both drop and close, so it
only means 'close' when it's sent while the dropdown is dropped down).

--
Larry Lard
la*******@googl email.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version
Aug 8 '06 #2

"Larry Lard" <la*******@goog lemail.comwrote in message
news:4j******** ****@individual .net...
Steve Marshall wrote:
>I'm working on an owner-drawn combo box which has extended
functionalit y. I have to do something to the dropdown list when it
drops down, then undo it when it is closed up again. But I can't see
an event which seems to be a "CloseUp" event - is there such an event?
Surely there must be!

.NET 2.0: DropDownClosed
Earlier: Override the WndProc message and watch for message
CB_SHOWDROPDOWN (this same message is sent on both drop and close, so it
only means 'close' when it's sent while the dropdown is dropped down).
CB_SHOWDROPDOWN is not a notification message. It's used to drop down the
list programatically . To know when the list closes up you should use the
CBN_CLOSEUP notification. Here's the code for that:

Public Class ComboBoxEx
Inherits ComboBox
Private Const WM_USER As Integer = &H400
Private Const WM_COMMAND As Integer = &H111
Private Const OCM__BASE As Integer = WM_USER + &H1C00
Private Const OCM_COMMAND As Integer = OCM__BASE + WM_COMMAND

Private Function HIWORD(ByVal value As Integer) As Short
Return CShort(New System.Drawing. Point(value).Y)
End Function

Protected Overrides Sub WndProc(ByRef m As System.Windows. Forms.Message)
If m.Msg = OCM_COMMAND Then
Dim code As Integer = HIWORD(m.WParam .ToInt32)
If code = CBN_CLOSEUP Then
OnCloseUp(Event Args.Empty)
End If
End If
MyBase.WndProc( m)
End Sub

Protected Overridable Sub OnCloseUp(ByVal e As System.EventArg s)
RaiseEvent CloseUp(Me, e)
End Sub

Public Event CloseUp As EventHandler
End Class

/claes
Aug 8 '06 #3
Many thanks Claes. I had tried what Larry suggested, but my WndProc
override routine never saw the CB_SHOWDROPDOWN message, so I was about
to post a further question about it. Your contribution is perfectly
timed!

Aug 9 '06 #4
Claes Bergefall wrote:
"Larry Lard" <la*******@goog lemail.comwrote in message
news:4j******** ****@individual .net...
>Steve Marshall wrote:
>>I'm working on an owner-drawn combo box which has extended
functionality . I have to do something to the dropdown list when it
drops down, then undo it when it is closed up again. But I can't see
an event which seems to be a "CloseUp" event - is there such an event?
Surely there must be!
.NET 2.0: DropDownClosed
Earlier: Override the WndProc message and watch for message
CB_SHOWDROPDOW N (this same message is sent on both drop and close, so it
only means 'close' when it's sent while the dropdown is dropped down).

CB_SHOWDROPDOWN is not a notification message. It's used to drop down the
list programatically . To know when the list closes up you should use the
CBN_CLOSEUP notification. Here's the code for that:
That's what I deserve for skimming API docs too quickly, I suppose.
Thanks for sorting me out.
--
Larry Lard
la*******@googl email.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version
Aug 9 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1499
by: Jan Danielsson | last post by:
Hello all, I have a list of integers: q = which I would like to convert to a string: "1,2,4,7,9"
27
3081
by: Ron Adam | last post by:
There seems to be a fair amount of discussion concerning flow control enhancements lately. with, do and dowhile, case, etc... So here's my flow control suggestion. ;-) It occurred to me (a few weeks ago while trying to find the best way to form a if-elif-else block, that on a very general level, an 'also' statement might be useful. So I was wondering what others would think of it.
24
2572
by: Alf P. Steinbach | last post by:
The eighth chapter (chapter 2.1) of my attempted Correct C++ tutorial is now available, although for now only in Word format -- comments welcome! Use the free & system-independent Open Office if you don't have Word. Classes <url: http://home.no.net/dubjai/win32cpptut/w32cpptut_02_01.zip> Introduces the C++ language feature used to define new types, namely classes. The focus in on creating safe and reusable classes. As a main
32
3209
by: Christopher Benson-Manica | last post by:
Is the following code legal, moral, and advisable? #include <iostream> class A { private: int a; public: A() : a(42) {}
6
1391
by: PaulR | last post by:
We have seen this a lot, but have just experienced the opposite to what we have always seen previously, so this has prompted me to ask a high level - why do we get this behaviour? If we re-write queries in the following pattern (simplified) select ... from table1 t1 inner join table2 t2 on (t1.pk = t2.fk) inner join table3 t3 on (t3.fk = t2.pk)
388
21942
by: maniac | last post by:
Hey guys, I'm new here, just a simple question. I'm learning to Program in C, and I was recommended a book called, "Mastering C Pointers", just asking if any of you have read it, and if it's worth the $25USD. I'm just looking for a book on Pointers, because from what I've read it's one of the toughest topics to understand. thanks in advanced.
15
6736
by: Joe Van Dyk | last post by:
Can someone explain what a heap and what a stack is? And why I should care? I used to know, but then I forgot. And I can't seem to find it in the C++ FAQ. I keep reading how allocating from the heap is slow or something, and I have no idea why that would be. Joe
11
2244
by: arnuld | last post by:
i have created a new temperature conversion programme. it converts a temperature from Fahrenheit to Celsius or from Celsius to Fahrenheit at user's will. tell em if i need some improvements: // conversion of temperature // using Centigrade and Fahrenheit #include <iostream> int main() {
3
2235
by: Jukka K. Korpela | last post by:
Some time ago in this group, someone suggested that we should develop a "different" user style sheet to demonstrate what a user style sheet or a browser style sheet _could_ do. I guess the idea was that the style would be rather different from common browser defaults, yet sensible and potentially useful. Partly for that reason, partly to demonstrate the idea that web page rendering _could_ be different from what people are used to, I...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10485
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10252
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10231
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9073
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.