1. [WIN] change bkgnd color of combo box
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Oct 24, 2000
- 488 views
Is it possible to change the background color of the list portion of a combo box? I have two combo boxes one above another, & would like to make it more clear which one has been opened by making them have different background colors. Dan Moyer
2. Re: [WIN] change bkgnd color of combo box
- Posted by Matt Lewis <matthewwalkerlewis at YAHOO.COM> Oct 24, 2000
- 463 views
--- Dan B Moyer <DANMOYER at PRODIGY.NET> wrote: > Is it possible to change the background color of the list portion of a combo > box? > > I have two combo boxes one above another, & would like to make it more clear > which one has been opened by making them have different background colors. It looks like it's possible by trapping the WM_CTLCOLOR message. Do a search at http://msdn.microsoft.com on 'combo color'. ===== Matt Lewis http://www.realftp.com/matthewlewis __________________________________________________ Do You Yahoo!? Yahoo! Messenger - Talk while you surf! It's FREE. http://im.yahoo.com/
3. Re: [WIN] change bkgnd color of combo box
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Oct 24, 2000
- 497 views
Matt, Thanks, by doing the search you suggested, I found but I don't know how to "trap" the WM_CTLCOLOR message. Can you give me a small example? Dan ----- Original Message ----- From: "Matt Lewis" <matthewwalkerlewis at YAHOO.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Tuesday, October 24, 2000 7:12 PM Subject: Re: [WIN] change bkgnd color of combo box > --- Dan B Moyer <DANMOYER at PRODIGY.NET> wrote: > > Is it possible to change the background color of the list portion of a combo > > box? > > > > I have two combo boxes one above another, & would like to make it more clear > > which one has been opened by making them have different background colors. > > It looks like it's possible by trapping the WM_CTLCOLOR message. Do a search > at http://msdn.microsoft.com on 'combo color'. > > > ===== > Matt Lewis > http://www.realftp.com/matthewlewis > > __________________________________________________ > Do You Yahoo!? > Yahoo! Messenger - Talk while you surf! It's FREE. > http://im.yahoo.com/
4. Re: [WIN] change bkgnd color of combo box
- Posted by Matt Lewis <matthewwalkerlewis at YAHOO.COM> Oct 24, 2000
- 466 views
- Last edited Oct 25, 2000
--- Dan B Moyer <DANMOYER at PRODIGY.NET> wrote: > but I don't know how to "trap" the WM_CTLCOLOR message. Can you give me a > small example? OK, this should get you started. You need to create an onEvent procedure for the parent of the combo (I think--the parent of the list box gets the message, and I'm not certain if the combo or the combo's parent gets it). Once you've done that, you need to return the handle to a brush. So (untested): -- begin code include win32lib.ew constant Win = create(Window,"Custom Combo", 0, 20, 20, 300, 300, 0), CB = create( Combo,"", Win, 20, 20, 90, 180, 0 ) addItem(CB, "One" ) addItem(CB, "Two" ) addItem(CB, "Etc..." ) constant myColor = #0, -- an rgb value here myBrush = c_func( xCreateSolidBrush, { myColor } ) -- This might not be such a great idea. You might -- be better off creating and destroying the pen -- each time you draw the list box, although -- if this works, it's probably faster. -- If you move this to within the event code, -- you'll need to change ForProgram to ForPaint trackObject( getSelf(), CB, ForProgram ) procedure CB_onEvent( integer iMsg, atom wParam, atom lParam ) -- Win9x uses specific msgs now instead of WM_CTLCOLOR -- with a notification if iMsg = WM_CTLCOLORLISTBOX then return brush end if end procedure -- you may have to change this to Win's event handler... onEvent[CB] = routine_id("CB_onEvent") -- end code Other messages you might be interested in (which should work the same as WM_CTLCOLORLISTBOX): WM_CTLCOLOREDIT WM_CTLCOLORSCROLLBAR WM_CTLCOLORBTN WM_CTLCOLORSTATIC These should all be defined for you in winconst.ew (in the archives--by Jaques D). Now that I've looked at these, I think they should probably be incorporated into Win32Lib, to enable more flexible color schemes. ===== Matt Lewis http://www.realftp.com/matthewlewis __________________________________________________ Do You Yahoo!? Yahoo! Messenger - Talk while you surf! It's FREE. http://im.yahoo.com/
5. Re: [WIN] change bkgnd color of combo box
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Oct 25, 2000
- 460 views
Thanks Matt, I'll give it a try! Dan ----- Original Message ----- From: "Matt Lewis" <matthewwalkerlewis at YAHOO.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Tuesday, October 24, 2000 8:55 PM Subject: Re: [WIN] change bkgnd color of combo box > --- Dan B Moyer <DANMOYER at PRODIGY.NET> wrote: > > > but I don't know how to "trap" the WM_CTLCOLOR message. Can you give me a > > small example? > > OK, this should get you started. You need to create an onEvent procedure for > the parent of the combo (I think--the parent of the list box gets the message, > and I'm not certain if the combo or the combo's parent gets it). Once you've > done that, you need to return the handle to a brush. > > So (untested): > > -- begin code > include win32lib.ew > > constant > Win = create(Window,"Custom Combo", 0, 20, 20, 300, 300, 0), > CB = create( Combo,"", Win, 20, 20, 90, 180, 0 ) > > addItem(CB, "One" ) > addItem(CB, "Two" ) > addItem(CB, "Etc..." ) > > constant myColor = #0, -- an rgb value here > myBrush = c_func( xCreateSolidBrush, { myColor } ) > -- This might not be such a great idea. You might > -- be better off creating and destroying the pen > -- each time you draw the list box, although > -- if this works, it's probably faster. > > -- If you move this to within the event code, > -- you'll need to change ForProgram to ForPaint > trackObject( getSelf(), CB, ForProgram ) > > procedure CB_onEvent( integer iMsg, atom wParam, atom lParam ) > > -- Win9x uses specific msgs now instead of WM_CTLCOLOR > -- with a notification > > if iMsg = WM_CTLCOLORLISTBOX then > return brush > end if > > end procedure > -- you may have to change this to Win's event handler... > onEvent[CB] = routine_id("CB_onEvent") > > > -- end code > > Other messages you might be interested in (which should work the same as > WM_CTLCOLORLISTBOX): > WM_CTLCOLOREDIT > WM_CTLCOLORSCROLLBAR > WM_CTLCOLORBTN > WM_CTLCOLORSTATIC > > These should all be defined for you in winconst.ew (in the archives--by Jaques > D). Now that I've looked at these, I think they should probably be > incorporated into Win32Lib, to enable more flexible color schemes. > > > ===== > Matt Lewis > http://www.realftp.com/matthewlewis > > __________________________________________________ > Do You Yahoo!? > Yahoo! Messenger - Talk while you surf! It's FREE. > http://im.yahoo.com/
6. Re: [WIN] change bkgnd color of combo box
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Oct 25, 2000
- 482 views
Matt, Well, I don't really have much idea what it is you're doing in your example, but I'm game to try & understand it. To get it to run I had to change some things, not sure if that defeated any chance of it doing what I wanted or not. In "trackObject", I changed "getSelf()" to "Win" because it brought up an error the original way, not sure what, it's over 300 lines :( with Win32Lib 50. Had to comment out "return brush" in the event trap(?), because brush not declared; was that supposed to relate somehow to "myBrush" (didn't work when I put that there), or get something from iMsg, or what?? And I added "WinMain". Can you give me an idea what is supposed to be going on in your example? Dan P.S.: Here's what it looks like after I made those changes: -- begin code include win32lib.ew global constant Win = create(Window,"Custom Combo", 0, 20, 20, 300, 300, 0), CB = create( Combo,"", Win, 20, 20, 90, 180, 0 ) addItem(CB, "One" ) addItem(CB, "Two" ) addItem(CB, "Etc..." ) constant myColor = #0, -- an rgb value here myBrush = c_func( xCreateSolidBrush, { myColor } ) -- This might not be such a great idea. You might -- be better off creating and destroying the pen -- each time you draw the list box, although -- if this works, it's probably faster. -- If you move this to within the event code, -- you'll need to change ForProgram to ForPaint trackObject(Win, CB, ForProgram )--CHANGED getSelf()TO Win BECAUSE ERROR'D procedure CB_onEvent( integer iMsg, atom wParam, atom lParam ) -- Win9x uses specific msgs now instead of WM_CTLCOLOR -- with a notification if iMsg = WM_CTLCOLORLISTBOX then -- return brush -- HAD TO COMMMENT THIS OUT TO GET PROGRAM TO RUN end if end procedure -- you may have to change this to Win's event handler... onEvent[CB] = routine_id("CB_onEvent") WinMain( Win, Normal )-- ADDED THIS -- end code ----- Original Message ----- From: "Matt Lewis" <matthewwalkerlewis at YAHOO.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Tuesday, October 24, 2000 8:55 PM Subject: Re: [WIN] change bkgnd color of combo box > --- Dan B Moyer <DANMOYER at PRODIGY.NET> wrote: > > > but I don't know how to "trap" the WM_CTLCOLOR message. Can you give me a > > small example? > > OK, this should get you started. You need to create an onEvent procedure for > the parent of the combo (I think--the parent of the list box gets the message, > and I'm not certain if the combo or the combo's parent gets it). Once you've > done that, you need to return the handle to a brush. > > So (untested): > > -- begin code > include win32lib.ew > > constant > Win = create(Window,"Custom Combo", 0, 20, 20, 300, 300, 0), > CB = create( Combo,"", Win, 20, 20, 90, 180, 0 ) > > addItem(CB, "One" ) > addItem(CB, "Two" ) > addItem(CB, "Etc..." ) > > constant myColor = #0, -- an rgb value here > myBrush = c_func( xCreateSolidBrush, { myColor } ) > -- This might not be such a great idea. You might > -- be better off creating and destroying the pen > -- each time you draw the list box, although > -- if this works, it's probably faster. > > -- If you move this to within the event code, > -- you'll need to change ForProgram to ForPaint > trackObject( getSelf(), CB, ForProgram ) > > procedure CB_onEvent( integer iMsg, atom wParam, atom lParam ) > > -- Win9x uses specific msgs now instead of WM_CTLCOLOR > -- with a notification > > if iMsg = WM_CTLCOLORLISTBOX then > return brush > end if > > end procedure > -- you may have to change this to Win's event handler... > onEvent[CB] = routine_id("CB_onEvent") > > > -- end code > > Other messages you might be interested in (which should work the same as > WM_CTLCOLORLISTBOX): > WM_CTLCOLOREDIT > WM_CTLCOLORSCROLLBAR > WM_CTLCOLORBTN > WM_CTLCOLORSTATIC > > These should all be defined for you in winconst.ew (in the archives--by Jaques > D). Now that I've looked at these, I think they should probably be > incorporated into Win32Lib, to enable more flexible color schemes. > > > ===== > Matt Lewis > http://www.realftp.com/matthewlewis > > __________________________________________________ > Do You Yahoo!? > Yahoo! Messenger - Talk while you surf! It's FREE. > http://im.yahoo.com/
7. Re: [WIN] change bkgnd color of combo box
- Posted by Matthew Lewis <MatthewL at KAPCOUSA.COM> Oct 25, 2000
- 517 views
Yeah, that's what I get for doing this without testing (I didn't have Eu where I wrote that)...I'd originally had trackObject() in the proc. Also, you need to use returnValue(myBrush). Change the procedure to the following: -- begin code procedure CB_onEvent( integer iMsg, atom wParam, atom lParam ) if iMsg = WM_CTLCOLORLISTBOX then returnValue( myBrush ) end if end procedure onEvent[CB] = routine_id("CB_onEvent") -- end code The only problem with this is that it doesn't affect the background of the text in the box. I'm not sure how to get at that to change it. :( Matt Lewis http://www.realftp.com/matthewlewis
8. Re: [WIN] change bkgnd color of combo box
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Oct 25, 2000
- 470 views
Matt, That's ok, the best I can do is to conceive pseudo-code in my head, couldn't even attempt to make real code without interactive access to Euphoria! I'll give it a try & see what happens. Thanks! Dan ----- Original Message ----- From: "Matthew Lewis" <MatthewL at KAPCOUSA.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Wednesday, October 25, 2000 9:01 AM Subject: Re: [WIN] change bkgnd color of combo box > Yeah, that's what I get for doing this without testing (I didn't have Eu > where I wrote that)...I'd originally had trackObject() in the proc. Also, > you need to use returnValue(myBrush). > > Change the procedure to the following: > > -- begin code > > procedure CB_onEvent( integer iMsg, atom wParam, atom lParam ) > > if iMsg = WM_CTLCOLORLISTBOX then > returnValue( myBrush ) > end if > > end procedure > onEvent[CB] = routine_id("CB_onEvent") > > -- end code > > The only problem with this is that it doesn't affect the background of the > text in the box. I'm not sure how to get at that to change it. :( > > Matt Lewis > http://www.realftp.com/matthewlewis
9. Re: [WIN] change bkgnd color of combo box
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Oct 25, 2000
- 497 views
Matt, Oh, yeah, it *doesn't* actually change the *background* of the text in the list, it changes the *non-text space* in the list. Back to the drawing board... Dan ----- Original Message ----- From: "Matthew Lewis" <MatthewL at KAPCOUSA.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Wednesday, October 25, 2000 9:01 AM Subject: Re: [WIN] change bkgnd color of combo box > Yeah, that's what I get for doing this without testing (I didn't have Eu > where I wrote that)...I'd originally had trackObject() in the proc. Also, > you need to use returnValue(myBrush). > > Change the procedure to the following: > > -- begin code > > procedure CB_onEvent( integer iMsg, atom wParam, atom lParam ) > > if iMsg = WM_CTLCOLORLISTBOX then > returnValue( myBrush ) > end if > > end procedure > onEvent[CB] = routine_id("CB_onEvent") > > -- end code > > The only problem with this is that it doesn't affect the background of the > text in the box. I'm not sure how to get at that to change it. :( > > Matt Lewis > http://www.realftp.com/matthewlewis
10. Re: [WIN] change bkgnd color of combo box
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Oct 25, 2000
- 471 views
Matt, Here are some links I found which *might* relate to my question about changing the background color of a combo box's list box; some may be relevant only to Win 3.0 or Win 3.1, but the first one looks like it might mean something, but I'm not sure what. What seems to me to be the problem is specifically changing the *background brush* ? Dan onctlcolor.htm ----- Original Message ----- From: "Matthew Lewis" <MatthewL at KAPCOUSA.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Wednesday, October 25, 2000 9:01 AM Subject: Re: [WIN] change bkgnd color of combo box > Yeah, that's what I get for doing this without testing (I didn't have Eu > where I wrote that)...I'd originally had trackObject() in the proc. Also, > you need to use returnValue(myBrush). > > Change the procedure to the following: > > -- begin code > > procedure CB_onEvent( integer iMsg, atom wParam, atom lParam ) > > if iMsg = WM_CTLCOLORLISTBOX then > returnValue( myBrush ) > end if > > end procedure > onEvent[CB] = routine_id("CB_onEvent") > > -- end code > > The only problem with this is that it doesn't affect the background of the > text in the box. I'm not sure how to get at that to change it. :( > > Matt Lewis > http://www.realftp.com/matthewlewis
11. Re: [WIN] change bkgnd color of combo box
- Posted by Bernie <xotron at PCOM.NET> Oct 25, 2000
- 474 views
- Last edited Oct 26, 2000
On Wed, 25 Oct 2000 16:50:30 -0700, Dan B Moyer <DANMOYER at PRODIGY.NET> wrote: >mean something, but I'm not sure what. What seems to me to be the problem >is specifically changing the *background brush* ? Matt: I think that in order to use colors or icons or pictures in a listbox it has to be a OWNERDRAW listbox and you have all the painting details must be all handled by your windows application. Bernie
12. Re: [WIN] change bkgnd color of combo box
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Oct 25, 2000
- 486 views
- Last edited Oct 26, 2000
Bernie, I'm far from sure, but I think that only applied to win 3.0. >From http://support.microsoft.com/support/kb/articles/Q81/7/07.ASP: Under Windows 3.0, the text color problem discussed above for CBS_DROPDOWN-style combo boxes is evident for CBS_DROPDOWNLIST combo boxes. To address this problem, the application must use an owner-draw combo box. Although it is not necessary to use an owner-draw combo box under Windows 3.1, the application must process the CTLCOLOR_LISTBOX notification in both the combo box subclass procedure and in the window procedure for the parent window of the combo box. Still not sure what it all means, though. Dan ----- Original Message ----- From: "Bernie" <xotron at PCOM.NET> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Wednesday, October 25, 2000 5:12 PM Subject: Re: [WIN] change bkgnd color of combo box > On Wed, 25 Oct 2000 16:50:30 -0700, Dan B Moyer <DANMOYER at PRODIGY.NET> > wrote: > > >mean something, but I'm not sure what. What seems to me to be the problem > >is specifically changing the *background brush* ? > > Matt: > I think that in order to use colors or icons or pictures > in a listbox it has to be a OWNERDRAW listbox and you have > all the painting details must be all handled by your > windows application. > > Bernie