1. [WIN] how make empty combo not "open" (dropdown) if clicked on?

I have a combo box (defined as a DropDownList), which sometimes has stuff in
it & sometimes doesn't, and I want it *not* to drop down if it's clicked on
and there's nothing in it.  Nothing I've tried works.  Here's the last thing
I tried, can anyone suggest something that would work?  (I tried commenting
out my "getCount" test, in case something was happening I didn't know about,
and the list still drops down when clicked on.)


procedure Combo3_onEvent (atom event, atom wParam, atom lParam)

  if event = CBN_DROPDOWN then
    if getCount(Combo3) = 0 then  -- if nothing in combo, close it
       dummy = sendMessage(Combo3,CB_SHOWDROPDOWN , False,0)
    end if
  end if
end procedure
onEvent[Combo3] = routine_id("Combo3_onEvent")

Dan Moyer

new topic     » topic index » view message » categorize

2. Re: [WIN] how make empty combo not "open" (dropdown) if clicked on?

I think I would try sending a message  useing CB_GETCOUNT and because
the index is zero-based if the return value is  > 0 then it must contain items 
when I had this established I could proceed.to CB_SHOWDROPDOWN true 

what about you? I havent tried this but its sounds resonable.

Something like this:

procedure Combo3_onEvent (atom event, atom wParam, atom lParam)
  if event = CBN_DROPDOWN then
    if sendMessage(Combo3,CB_GETCOUNT, 0,0) > 0 then
       dummy = sendMessage(Combo3,CB_SHOWDROPDOWN , True,0)
    end if
  end if
end procedure
onEvent[Combo3] = routine_id("Combo3_onEvent")

Euman
euman at bellsouth.net


> I have a combo box (defined as a DropDownList), which sometimes has stuff in
> it & sometimes doesn't, and I want it *not* to drop down if it's clicked on
> and there's nothing in it.  Nothing I've tried works.  Here's the last thing
> I tried, can anyone suggest something that would work?  (I tried commenting
> out my "getCount" test, in case something was happening I didn't know about,
> and the list still drops down when clicked on.)
> 
> 
> procedure Combo3_onEvent (atom event, atom wParam, atom lParam)
> 
>   if event = CBN_DROPDOWN then
>     if getCount(Combo3) = 0 then  -- if nothing in combo, close it
>        dummy = sendMessage(Combo3,CB_SHOWDROPDOWN , False,0)
>     end if
>   end if
> end procedure
> onEvent[Combo3] = routine_id("Combo3_onEvent")
> 
> Dan Moyer

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

3. Re: [WIN] how make empty combo not "open" (dropdown) if clicked on?

Correction actually addition to the code I sent...

procedure Combo3_onEvent (atom event, atom wParam, atom lParam)
  if event = CBN_DROPDOWN then
    if sendMessage(Combo3,CB_GETCOUNT, 0,0) > 0 then
       dummy = sendMessage(Combo3,CB_SHOWDROPDOWN , True,0)
   else
       dummy = sendMessage(Combo3,CB_SHOWDROPDOWN ,False,0)
    end if
  end if
end procedure
onEvent[Combo3] = routine_id("Combo3_onEvent")

Euman
euman at bellsouth.net

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

4. Re: [WIN] how make empty combo not "open" (dropdown) if clicked on?

I can think of three quick ways to do this.

1) Make it disabled if it contains nothing.

2) Set the height to zero if it contains nothing.

3) Make windows ignore the dropdown message

   if event = CBN_DROPDOWN then
     if getCount(Combo3) = 0 then  -- if nothing in combo, ignore it
        returnValue(0)
     end if
   end if

----- Original Message -----
From: "Dan Moyer" <DANIELMOYER at prodigy.net>
To: "EUforum" <EUforum at topica.com>
Sent: Sunday, October 21, 2001 1:48 PM
Subject: [WIN] how make empty combo not "open" (dropdown) if clicked on?


>
> I have a combo box (defined as a DropDownList), which sometimes has stuff
in
> it & sometimes doesn't, and I want it *not* to drop down if it's clicked
on
> and there's nothing in it.  Nothing I've tried works.  Here's the last
thing
> I tried, can anyone suggest something that would work?  (I tried
commenting
> out my "getCount" test, in case something was happening I didn't know
about,
> and the list still drops down when clicked on.)
>
>
> procedure Combo3_onEvent (atom event, atom wParam, atom lParam)
>
>   if event = CBN_DROPDOWN then
>     if getCount(Combo3) = 0 then  -- if nothing in combo, close it
>        dummy = sendMessage(Combo3,CB_SHOWDROPDOWN , False,0)
>     end if
>   end if
> end procedure
> onEvent[Combo3] = routine_id("Combo3_onEvent")
>
> Dan Moyer
>
>
>

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

5. Re: [WIN] how make empty combo not "open" (dropdown) if clicked on?

Euman,

Using sendMessage to get the combo count didn't work any better than my
original use of getCount, but that's pretty reasonable, right?  getCount
probably *uses* sendMessage(Combo3,CB_GETCOUNT, 0,0) .  The problem seems to
be that even if it's told by "dummy = sendMessage(Combo3,CB_SHOWDROPDOWN
,False,0)"
to close the list down, somehow the "windows" action of opening the combo on
click predominates, *unless* you make windows ignore its normal action by
Derek's suggestion of returnValue(0) if count = 0.

Thanks for trying, though :)

Dan


----- Original Message -----
From: <euman at bellsouth.net>
To: "EUforum" <EUforum at topica.com>
Sent: Saturday, October 20, 2001 11:46 PM
Subject: Re: [WIN] how make empty combo not "open" (dropdown) if clicked on?


>
> Correction actually addition to the code I sent...
>
> procedure Combo3_onEvent (atom event, atom wParam, atom lParam)
>   if event = CBN_DROPDOWN then
>     if sendMessage(Combo3,CB_GETCOUNT, 0,0) > 0 then
>        dummy = sendMessage(Combo3,CB_SHOWDROPDOWN , True,0)
>    else
>        dummy = sendMessage(Combo3,CB_SHOWDROPDOWN ,False,0)
>     end if
>   end if
> end procedure
> onEvent[Combo3] = routine_id("Combo3_onEvent")
>
> Euman
> euman at bellsouth.net
>
>
>

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

6. Re: [WIN] how make empty combo not "open" (dropdown) if clicked on?

Thanks Derek,

I used suggestion 3, (make windows ignore the dropdown message), which
worked in almost every case, and then used a variation on suggestion 1,
(make it disabled if it contains nothing), to make the combo selectively
disabled and re-enabled to take care of the remaining circumstances where it
still could be opened when it was empty (in some circumstances the combo3
dropdown would get "blued" in, and in that case, even though it was empty
and suggestion 3 was in force and acting in other cases, it would still open
an empty combo; but making it disabled *before* that "blued-in" could occur,
and then re-enabling it when I need to use it, fixed that problem.)

Thanks again,

Dan
----- Original Message -----
From: "Derek Parnell" <ddparnell at bigpond.com>
To: "EUforum" <EUforum at topica.com>
Sent: Saturday, October 20, 2001 11:15 PM
Subject: Re: [WIN] how make empty combo not "open" (dropdown) if clicked on?


>
> I can think of three quick ways to do this.
>
> 1) Make it disabled if it contains nothing.
>
> 2) Set the height to zero if it contains nothing.
>
> 3) Make windows ignore the dropdown message
>
>    if event = CBN_DROPDOWN then
>      if getCount(Combo3) = 0 then  -- if nothing in combo, ignore it
>         returnValue(0)
>      end if
>    end if
>
> ----- Original Message -----
> From: "Dan Moyer" <DANIELMOYER at prodigy.net>
> To: "EUforum" <EUforum at topica.com>
> Sent: Sunday, October 21, 2001 1:48 PM
> Subject: [WIN] how make empty combo not "open" (dropdown) if clicked on?
>
>
> > I have a combo box (defined as a DropDownList), which sometimes has
stuff
> in
> > it & sometimes doesn't, and I want it *not* to drop down if it's clicked
> on
> > and there's nothing in it.  Nothing I've tried works.  Here's the last
> thing
> > I tried, can anyone suggest something that would work?  (I tried
> commenting
> > out my "getCount" test, in case something was happening I didn't know
> about,
> > and the list still drops down when clicked on.)
> >
> >
> > procedure Combo3_onEvent (atom event, atom wParam, atom lParam)
> >
> >   if event = CBN_DROPDOWN then
> >     if getCount(Combo3) = 0 then  -- if nothing in combo, close it
> >        dummy = sendMessage(Combo3,CB_SHOWDROPDOWN , False,0)
> >     end if
> >   end if
> > end procedure
> > onEvent[Combo3] = routine_id("Combo3_onEvent")
> >
> > Dan Moyer
> >
> >
>
>

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

7. Re: [WIN] how make empty combo not "open" (dropdown) if clicked on?

Must be in the onEvent system of Win32lib, Im not sure.
it just looked like it would work..

Euman
euman at bellsouth.net


> Euman,
> 
> Using sendMessage to get the combo count didn't work any better than my
> original use of getCount, but that's pretty reasonable, right?  getCount
> probably *uses* sendMessage(Combo3,CB_GETCOUNT, 0,0) .  The problem seems to
> be that even if it's told by "dummy = sendMessage(Combo3,CB_SHOWDROPDOWN
> ,False,0)"
> to close the list down, somehow the "windows" action of opening the combo on
> click predominates, *unless* you make windows ignore its normal action by
> Derek's suggestion of returnValue(0) if count = 0.
> 
> Thanks for trying, though :)
> 
> Dan
> 
> 
> ----- Original Message -----
> From: <euman at bellsouth.net>
> To: "EUforum" <EUforum at topica.com>
> Sent: Saturday, October 20, 2001 11:46 PM
> Subject: Re: [WIN] how make empty combo not "open" (dropdown) if clicked on?
> 
> 
> > Correction actually addition to the code I sent...
> >
> > procedure Combo3_onEvent (atom event, atom wParam, atom lParam)
> >   if event = CBN_DROPDOWN then
> >     if sendMessage(Combo3,CB_GETCOUNT, 0,0) > 0 then
> >        dummy = sendMessage(Combo3,CB_SHOWDROPDOWN , True,0)
> >    else
> >        dummy = sendMessage(Combo3,CB_SHOWDROPDOWN ,False,0)
> >     end if
> >   end if
> > end procedure
> > onEvent[Combo3] = routine_id("Combo3_onEvent")
> >
> > Euman
> > euman at bellsouth.net
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu