1. [WIN] "open" simple combo box programmatically

Is it possible to "open" a simple combo box programmatically?

By that I mean, if you have a simple combo box and you click on the element
of the list that's displayed in the "edit" box portion of it, then the
*list* unfolds & is displayed; but can you force it to "open" or "unfold"
programmatically?

I have two related combo boxes, one has *categories* of things, the other is
then populated with the appropriate things depending on what category is
chosen, but I want the second combo box to automatically unfold when a
category is chosen in the first combo box.  Can this be done, & if so how?

Dan Moyer

new topic     » topic index » view message » categorize

2. Re: [WIN] "open" simple combo box programmatically

It sounds like the second box needs to be a list box who's height you
control programatically. Each time a category is selected in the first box,
clear the second one and populate it with the related data and recalculate
it's height. You can set a maximum height and add a scroll bar if required.

------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)

----- Original Message -----
From: "Dan B Moyer" <DANMOYER at PRODIGY.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, October 20, 2000 6:20 PM
Subject: [WIN] "open" simple combo box programmatically


> Is it possible to "open" a simple combo box programmatically?
>
> By that I mean, if you have a simple combo box and you click on the
element
> of the list that's displayed in the "edit" box portion of it, then the
> *list* unfolds & is displayed; but can you force it to "open" or "unfold"
> programmatically?
>
> I have two related combo boxes, one has *categories* of things, the other
is
> then populated with the appropriate things depending on what category is
> chosen, but I want the second combo box to automatically unfold when a
> category is chosen in the first combo box.  Can this be done, & if so how?
>
> Dan Moyer

new topic     » goto parent     » topic index » view message » categorize

3. Re: [WIN] "open" simple combo box programmatically

Derek,

No, that's not it, (I think), the size seems to be working automatically and
just fine, as each new list of items is put into the second list on choosing
a category from the first, the first element of that list shows up in the
"edit" portion of the second; if the user *clicks* on that displayed
element, *then* the list "unfolds" to show all elements, and it does so just
fine, it's a big box for many items, and a small box for few. It's the
"unfolding" I'm trying to cause programmatically as soon as an item
(category) is clicked on in the first.

My ISP is doing maintenance & will stop sending me email in about a half
hour.

Dan


----- Original Message -----
From: "Derek Parnell" <dparnell at BIGPOND.NET.AU>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, October 20, 2000 12:28 AM
Subject: Re: [WIN] "open" simple combo box programmatically


> It sounds like the second box needs to be a list box who's height you
> control programatically. Each time a category is selected in the first
box,
> clear the second one and populate it with the related data and recalculate
> it's height. You can set a maximum height and add a scroll bar if
required.
>
> ------
> Derek Parnell
> Melbourne, Australia
> (Vote [1] The Cheshire Cat for Internet Mascot)
>
> ----- Original Message -----
> From: "Dan B Moyer" <DANMOYER at PRODIGY.NET>
> To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
> Sent: Friday, October 20, 2000 6:20 PM
> Subject: [WIN] "open" simple combo box programmatically
>
>
> > Is it possible to "open" a simple combo box programmatically?
> >
> > By that I mean, if you have a simple combo box and you click on the
> element
> > of the list that's displayed in the "edit" box portion of it, then the
> > *list* unfolds & is displayed; but can you force it to "open" or
"unfold"
> > programmatically?
> >
> > I have two related combo boxes, one has *categories* of things, the
other
> is
> > then populated with the appropriate things depending on what category is
> > chosen, but I want the second combo box to automatically unfold when a
> > category is chosen in the first combo box.  Can this be done, & if so
how?
> >
> > Dan Moyer

new topic     » goto parent     » topic index » view message » categorize

4. Re: [WIN] "open" simple combo box programmatically

Sorry Dan, its my fault. I didn't express myself very clearly.

I'm suggesting that you drop the idea of using a COMBOBOX for the second
list, and instead use a LISTBOX control. Then programatically control the
visualisation of it so that it "unfolds" by changing its height and "folds"
again also by changing its height.
In other words, why do you want the user to click on the second box? My
guess is that you don't actually want that. Instead you want the user to see
the contents at all times - without clicking.

The pseudo code would go something like this...

onClick_FirstBox:
  get item in first box.
  clear second box.
  set height of second box to one char high.
  add items to second box based on item in first box.
  set height of second box so that 'x' lines are visible.
  if 'x' < actual number of items, set a vertical scrollbar
     for the second box.
end onClick.

This would give the impression that the second box is automatically
expanding/contracting based on its contents. There is no need to click on
anything. Just use a LISTBOX rather than a COMBOBOX.

-----
cheers
Derek

------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)

----- Original Message -----
From: "Dan B Moyer" <DANMOYER at PRODIGY.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, October 20, 2000 6:38 PM
Subject: Re: [WIN] "open" simple combo box programmatically


> Derek,
>
> No, that's not it, (I think), the size seems to be working automatically
and
> just fine, as each new list of items is put into the second list on
choosing
> a category from the first, the first element of that list shows up in the
> "edit" portion of the second; if the user *clicks* on that displayed
> element, *then* the list "unfolds" to show all elements, and it does so
just
> fine, it's a big box for many items, and a small box for few. It's the
> "unfolding" I'm trying to cause programmatically as soon as an item
> (category) is clicked on in the first.
>
> My ISP is doing maintenance & will stop sending me email in about a half
> hour.
>
> Dan
>
>
> ----- Original Message -----
> From: "Derek Parnell" <dparnell at BIGPOND.NET.AU>
> To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
> Sent: Friday, October 20, 2000 12:28 AM
> Subject: Re: [WIN] "open" simple combo box programmatically
>
>
> > It sounds like the second box needs to be a list box who's height you
> > control programatically. Each time a category is selected in the first
> box,
> > clear the second one and populate it with the related data and
recalculate
> > it's height. You can set a maximum height and add a scroll bar if
> required.
> >
> > ------
> > Derek Parnell
> > Melbourne, Australia
> > (Vote [1] The Cheshire Cat for Internet Mascot)
> >
> > ----- Original Message -----
> > From: "Dan B Moyer" <DANMOYER at PRODIGY.NET>
> > To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
> > Sent: Friday, October 20, 2000 6:20 PM
> > Subject: [WIN] "open" simple combo box programmatically
> >
> >
> > > Is it possible to "open" a simple combo box programmatically?
> > >
> > > By that I mean, if you have a simple combo box and you click on the
> > element
> > > of the list that's displayed in the "edit" box portion of it, then the
> > > *list* unfolds & is displayed; but can you force it to "open" or
> "unfold"
> > > programmatically?
> > >
> > > I have two related combo boxes, one has *categories* of things, the
> other
> > is
> > > then populated with the appropriate things depending on what category
is
> > > chosen, but I want the second combo box to automatically unfold when a
> > > category is chosen in the first combo box.  Can this be done, & if so
> how?
> > >
> > > Dan Moyer

new topic     » goto parent     » topic index » view message » categorize

5. Re: [WIN] "open" simple combo box programmatically

Derek,

Hmm, you might be right.

But just in case I'm having trouble explaining myself, too, :)

I have one combo box full of *categories*; as a Simple Combo box, it starts
life as a small, single little box with one line of text in it  (the first
item in the hidden list), and a little arrow thingy at the right side of the
single line of text; if user clicks on the little arrow thingy, the first
combo box "opens" & shows its list;  if the user then *selects* one of the
items in the first combo boxes list, the list disappears and the item
selected is shown in the single little "edit" box; and, the *second* combo
box is now populated with the appropriate elements relating to the selected
category in the first combo box, and the first element in the second combo
shows up in its single one line box;

what I would *like* is that when the user has done the above, the *second*
combo box would automatically open & display its *list*, so the user could
then *select* from the items in it immediately, instead of having to click
first on the item in the combo boxes single line.

I suspect that the list box would or could work, but the combo box does
almost everything *automatically* (it sizes to the number of elements, as
long as you specify the *max* size expected), except for the unfolding; so
if I could get it to unfold automatically, simply, then I don't have to do
all the rest.

So if there's a "secret" command that would force the combo box to display
its list, I'd rather use that; if not, then I'll do it your way :)

Thanks,

Dan

----- Original Message -----
From: "Derek Parnell" <dparnell at BIGPOND.NET.AU>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, October 20, 2000 6:05 AM
Subject: Re: [WIN] "open" simple combo box programmatically


> Sorry Dan, its my fault. I didn't express myself very clearly.
>
> I'm suggesting that you drop the idea of using a COMBOBOX for the second
> list, and instead use a LISTBOX control. Then programatically control the
> visualisation of it so that it "unfolds" by changing its height and
"folds"
> again also by changing its height.
> In other words, why do you want the user to click on the second box? My
> guess is that you don't actually want that. Instead you want the user to
see
> the contents at all times - without clicking.
>
> The pseudo code would go something like this...
>
> onClick_FirstBox:
>   get item in first box.
>   clear second box.
>   set height of second box to one char high.
>   add items to second box based on item in first box.
>   set height of second box so that 'x' lines are visible.
>   if 'x' < actual number of items, set a vertical scrollbar
>      for the second box.
> end onClick.
>
> This would give the impression that the second box is automatically
> expanding/contracting based on its contents. There is no need to click on
> anything. Just use a LISTBOX rather than a COMBOBOX.
>
> -----
> cheers
> Derek
>
> ------
> Derek Parnell
> Melbourne, Australia
> (Vote [1] The Cheshire Cat for Internet Mascot)
>
> ----- Original Message -----
> From: "Dan B Moyer" <DANMOYER at PRODIGY.NET>
> To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
> Sent: Friday, October 20, 2000 6:38 PM
> Subject: Re: [WIN] "open" simple combo box programmatically
>
>
> > Derek,
> >
> > No, that's not it, (I think), the size seems to be working automatically
> and
> > just fine, as each new list of items is put into the second list on
> choosing
> > a category from the first, the first element of that list shows up in
the
> > "edit" portion of the second; if the user *clicks* on that displayed
> > element, *then* the list "unfolds" to show all elements, and it does so
> just
> > fine, it's a big box for many items, and a small box for few. It's the
> > "unfolding" I'm trying to cause programmatically as soon as an item
> > (category) is clicked on in the first.
> >
> > My ISP is doing maintenance & will stop sending me email in about a half
> > hour.
> >
> > Dan
> >
> >
> > ----- Original Message -----
> > From: "Derek Parnell" <dparnell at BIGPOND.NET.AU>
> > To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
> > Sent: Friday, October 20, 2000 12:28 AM
> > Subject: Re: [WIN] "open" simple combo box programmatically
> >
> >
> > > It sounds like the second box needs to be a list box who's height you
> > > control programatically. Each time a category is selected in the first
> > box,
> > > clear the second one and populate it with the related data and
> recalculate
> > > it's height. You can set a maximum height and add a scroll bar if
> > required.
> > >
> > > ------
> > > Derek Parnell
> > > Melbourne, Australia
> > > (Vote [1] The Cheshire Cat for Internet Mascot)
> > >
> > > ----- Original Message -----
> > > From: "Dan B Moyer" <DANMOYER at PRODIGY.NET>
> > > To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
> > > Sent: Friday, October 20, 2000 6:20 PM
> > > Subject: [WIN] "open" simple combo box programmatically
> > >
> > >
> > > > Is it possible to "open" a simple combo box programmatically?
> > > >
> > > > By that I mean, if you have a simple combo box and you click on the
> > > element
> > > > of the list that's displayed in the "edit" box portion of it, then
the
> > > > *list* unfolds & is displayed; but can you force it to "open" or
> > "unfold"
> > > > programmatically?
> > > >
> > > > I have two related combo boxes, one has *categories* of things, the
> > other
> > > is
> > > > then populated with the appropriate things depending on what
category
> is
> > > > chosen, but I want the second combo box to automatically unfold when
a
> > > > category is chosen in the first combo box.  Can this be done, & if
so
> > how?
> > > >
> > > > Dan Moyer

new topic     » goto parent     » topic index » view message » categorize

6. Re: [WIN] "open" simple combo box programmatically

Dan B Moyer wrote:

> Is it possible to "open" a simple combo box programmatically?

Yes.  Send the CB_SHOWDROPDOWN message:

CB_SHOWDROPDOWN

wParam = (WPARAM) (BOOL) fShow;     // the show/hide flag
lParam = 0;                         // not used; must be zero

-- Sample usage

constant CB_SHOWDROPDOWN = 335 -- not defined in win32lib
junk = sendMessage( MyCombo, CB_SHOWDROPDOWN, True, 0 )

-- end sample

Matt

new topic     » goto parent     » topic index » view message » categorize

7. Re: [WIN] "open" simple combo box programmatically

----- Original Message -----
From: "Matthew Lewis" <MatthewL at KAPCOUSA.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Saturday, October 21, 2000 2:22 AM
Subject: Re: [WIN] "open" simple combo box programmatically


>
> constant CB_SHOWDROPDOWN = 335 -- not defined in win32lib

Thanks Matt, it is now!
------
Derek Parnell

new topic     » goto parent     » topic index » view message » categorize

8. Re: [WIN] "open" simple combo box programmatically

Matt,

Thanks!!!  I'm really glad you included the "sample usage", that's a
wonderful practice.

Dan


----- Original Message -----
From: "Matthew Lewis" <MatthewL at KAPCOUSA.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, October 20, 2000 8:22 AM
Subject: Re: [WIN] "open" simple combo box programmatically


> Dan B Moyer wrote:
>
> > Is it possible to "open" a simple combo box programmatically?
>
> Yes.  Send the CB_SHOWDROPDOWN message:
>
> CB_SHOWDROPDOWN
>
> wParam = (WPARAM) (BOOL) fShow;     // the show/hide flag
> lParam = 0;                         // not used; must be zero
>
> -- Sample usage
>
> constant CB_SHOWDROPDOWN = 335 -- not defined in win32lib
> junk = sendMessage( MyCombo, CB_SHOWDROPDOWN, True, 0 )
>
> -- end sample
>
> Matt

new topic     » goto parent     » topic index » view message » categorize

9. Re: [WIN] "open" simple combo box programmatically

Derek,

All right!

Dan


----- Original Message -----
From: "Derek Parnell" <dparnell at BIGPOND.NET.AU>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, October 20, 2000 1:11 PM
Subject: Re: [WIN] "open" simple combo box programmatically


> ----- Original Message -----
> From: "Matthew Lewis" <MatthewL at KAPCOUSA.COM>
> To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
> Sent: Saturday, October 21, 2000 2:22 AM
> Subject: Re: [WIN] "open" simple combo box programmatically
>
>
> >
> > constant CB_SHOWDROPDOWN = 335 -- not defined in win32lib
>
> Thanks Matt, it is now!
> ------
> Derek Parnell

new topic     » goto parent     » topic index » view message » categorize

10. Re: [WIN] "open" simple combo box programmatically

Matt,

I've run into a problem with using CB_SHOWDROPDOWN to "open" a SIMPLE combo
box programmatically.  When it's opened programmatically with
CB_SHOWDROPDOWN, it's *not* always the right size to hold all elements of
the list, but if I open it "manually", it is.

I made the act of selecting an item in one simple combo box's list populate
a second combo box, and then used CB_SHOWDROPDOWN immediately after that to
make the second combo box's list open automatically.

That makes the second list open, but it doesn't always open to the *size*
necessary to show all the elements in the list (the number of elements in
the list will vary, depending on what was selected in the first list); but
if I *manually* click on the "edit" line portion of the second combo box,
the list *always* expands to show all the elements in the list, no matter
how few or many, and it's just the right size, not too big and not too
small.

But when the second combo box's list is expanded by CB_SHOWDROPDOWN,
sometimes it fits the number of elements, and sometimes it's too big, and
sometimes it's too small (seems to depend on what was shown just *before*,
and by what *method*, auto dropdown, or manual.

Is there some way to get the automatic dropdown from CB_SHOWDROPDOWN to
function like the manual click on the "edit" line does, so the list
automatically opens to the right size to show all elements of the list?


BTW:
I'm using a SIMPLE combo box on purpose, as opposed to a "regular" combo
box, as it makes the "edit" line into a static text box instead of being
editable, and I think maybe the *style* definitions for "simple" combo box
in Win32Lib may be at least a part of what's going on, because "simple" CB
has no scroll bar, and I think maybe CB_SHOWDROPDOWN may be showing the list
in relation to the scroll bar that isn't there (in other words, it only
shows *some* of the elements of the list, expecting that a scroll bar would
be there to be used to show the rest of them).

Any ideas??

Dan


----- Original Message -----
From: "Matthew Lewis" <MatthewL at KAPCOUSA.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, October 20, 2000 8:22 AM
Subject: Re: [WIN] "open" simple combo box programmatically


> Dan B Moyer wrote:
>
> > Is it possible to "open" a simple combo box programmatically?
>
> Yes.  Send the CB_SHOWDROPDOWN message:
>
> CB_SHOWDROPDOWN
>
> wParam = (WPARAM) (BOOL) fShow;     // the show/hide flag
> lParam = 0;                         // not used; must be zero
>
> -- Sample usage
>
> constant CB_SHOWDROPDOWN = 335 -- not defined in win32lib
> junk = sendMessage( MyCombo, CB_SHOWDROPDOWN, True, 0 )
>
> -- end sample
>
> Matt

new topic     » goto parent     » topic index » view message » categorize

11. Re: [WIN] "open" simple combo box programmatically

According to Microsoft, CB_SHOWDROPDOWN has no effect on CBS_SIMPLE style
combo boxes.
------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)


> BTW:
> I'm using a SIMPLE combo box on purpose, as opposed to a "regular" combo
> box, as it makes the "edit" line into a static text box instead of being
> editable, and I think maybe the *style* definitions for "simple" combo box
> in Win32Lib may be at least a part of what's going on, because "simple" CB
> has no scroll bar, and I think maybe CB_SHOWDROPDOWN may be showing the
list
> in relation to the scroll bar that isn't there (in other words, it only
> shows *some* of the elements of the list, expecting that a scroll bar
would
> be there to be used to show the rest of them).
>

new topic     » goto parent     » topic index » view message » categorize

12. Re: [WIN] "open" simple combo box programmatically

Derek,

Oh.  Nuts.

Well, then, is there a way to make a Combo box with *user specified* styles,
so I can make one that has a static label *like* the "SimpleCombo" that
Win32Lib creates, but *without* having CBS_SIMPLE style?  So it would have
only WS_CHILD, WS_VISIBLE, CBS_DROPDOWNLIST (for making it have the static
label instead of edit box), CBS_HASSTRINGS, and WS_TABSTOP ?  (in other
words, all the styles the "SimpleCombo" has, *except* CBS_SIMPLE )

Dan
----- Original Message -----
From: "Derek Parnell" <dparnell at BIGPOND.NET.AU>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, October 20, 2000 10:55 PM
Subject: Re: [WIN] "open" simple combo box programmatically


> According to Microsoft, CB_SHOWDROPDOWN has no effect on CBS_SIMPLE style
> combo boxes.
> ------
> Derek Parnell
> Melbourne, Australia
> (Vote [1] The Cheshire Cat for Internet Mascot)
>
>
> > BTW:
> > I'm using a SIMPLE combo box on purpose, as opposed to a "regular" combo
> > box, as it makes the "edit" line into a static text box instead of being
> > editable, and I think maybe the *style* definitions for "simple" combo
box
> > in Win32Lib may be at least a part of what's going on, because "simple"
CB
> > has no scroll bar, and I think maybe CB_SHOWDROPDOWN may be showing the
> list
> > in relation to the scroll bar that isn't there (in other words, it only
> > shows *some* of the elements of the list, expecting that a scroll bar
> would
> > be there to be used to show the rest of them).
> >

new topic     » goto parent     » topic index » view message » categorize

13. Re: [WIN] "open" simple combo box programmatically

Hi Dan,
well with win32lib v0.54, SimpleCombo doesn't have CBS_SIMPLE as a style
flag.

I'm doing the fininshing touches to the documenation tonight.
------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)


----- Original Message -----
From: "Dan B Moyer" <DANMOYER at PRODIGY.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Sunday, October 22, 2000 12:19 AM
Subject: Re: [WIN] "open" simple combo box programmatically


> Derek,
>
> Oh.  Nuts.
>
> Well, then, is there a way to make a Combo box with *user specified*
styles,
> so I can make one that has a static label *like* the "SimpleCombo" that
> Win32Lib creates, but *without* having CBS_SIMPLE style?  So it would have
> only WS_CHILD, WS_VISIBLE, CBS_DROPDOWNLIST (for making it have the static
> label instead of edit box), CBS_HASSTRINGS, and WS_TABSTOP ?  (in other
> words, all the styles the "SimpleCombo" has, *except* CBS_SIMPLE )
>
> Dan

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu