combobox and popupmenu color

Is it possible to change the color of the button of the combobox and a popupmenu ?
By default it comes in blue.
Also the color of the selected item of the listed items I need to change.
I will appreciate any help. I couldnt find any information at all.
Thanks

The best way I know of is to replace these controls by a TextField and a BevelButton for the button, and a ListBox for the dropDown. Start with the ListBox invisible, and render it visible when click on the button.

Thanks Michel… I beleive it is too much work for just change a color…
There must be an easy way to do it… dont you thinks so ?

but there isn’t :frowning:

[quote=288228:@Mariano Poli]Thanks Michel… I beleive it is too much work for just change a color…
There must be an easy way to do it… dont you thinks so ?[/quote]

It IS an easy way. Not very complicated, really. If you know how to put controls on a window, you know how to build this.

I do that in my own apps to display popupMenus with different fonts, like the menu in Word.

Put the controls onto a ContainerControl, and you can reuse that custom control anywhere.

At any rate, I am not aware of declares to do what you ask.

Sure Dave ?
If, as you said, there should be, and there isn’t, this means that XOJO has more limitations than I supposed it has !!!

[quote=288232:@Mariano Poli]Sure Dave ?
If, as you said, there should be, and there isn’t, this means that XOJO has more limitations than I supposed it has !!![/quote]

Neither XCode on Mac nor Visual Studio under Windows have that. Because it is absolutely non standard. How many apps do you see around doing that ?

But hey, don’t take our word for it.

Won’t you file a feature request ?

Michel… I am pretty sure that it is possible to do it what you suggest expending some coding time. Not to hard and I had done a lot of this such things in the past with VB. I wrongly expected not to have do it any more…

[quote=288232:@Mariano Poli]Sure Dave ?
If, as you said, there should be, and there isn’t, this means that XOJO has more limitations than I supposed it has !!![/quote]
That’s not so much a Xojo limitation as it is a system thing.
I haven’t seen another app does the interface changes you’ve been requesting, except the maybe the Apple Pro Tools.

Problem is simply that the native controls do not have color properties, or even change the color of the selection.

I just quickly looked through MSDN, there is no mention of any background color, text color, or selection color.

BTW in the new design guidelines Microsoft set forth, it is recommended to use ListBoxes instead of dropdown (Popumenu).

There is no easy way to do it. Not even in Objective-C on the Mac or in MFC or .NET on Windows. Standard controls provided by the operating system have standards which coincide with the UI guidelines published by Apple and Microsoft. Just don’t do it – users (especially on the Mac) will not like it. There are almost no applications (especially on the Mac) which do it.

And on OS X if you want to do it with standard controls you will have to use undocumented features. If I remember correctly NSComboBox is an NSButton combined with an NSTableView which you can access by using _tableView. Ugly, not future-safe, etc.

To help you get started on macOS, put this in the Open event of ComboBox:

[code]Declare Function cell Lib “Cocoa” Selector “cell” (NSComboBox As Ptr) As Ptr
Declare Function valueForKey Lib “Cocoa” Selector “valueForKey:” (NSObject As Ptr,
key As CFStringRef) As Ptr
Declare Sub setValue Lib “Cocoa” Selector “setValue:forKey:” (NSObject As Ptr, value As Ptr,
key As CFStringRef)
Declare Function NSClassFromString Lib “Cocoa” (aClassName As CFStringRef) As Ptr
Declare Function redColor Lib “Cocoa” Selector “redColor” (NSColorClass As Ptr) As Ptr

Dim comboBoxCell As Ptr = cell(Ptr(Me.Handle))
Dim tableView As Ptr = valueForKey(comboBoxCell, “_tableView”) // _tableView is undocumented
Dim clr As Ptr = redColor(NSClassFromString(“NSColor”))
setValue(tableView, clr, “_backgroundColor”) // _backgroundColor of _tableView is of course undocumented

Me.AddRow(“abc”)
Me.AddRow(“def”)
Me.AddRow(“ghi”)[/code]

When I was working at Apple France some third party went to show us their BASIC. They have butons (fancy buttons with colors, etc.) all around.

At q&a session, the first question was: do you have standard looking buttons, windows, etc. ? And: do you know the color you used are not standard in the Operating System ?

Of course, you can do what you want, but remember your users: they may be astonished (stoned without fire) by the unusual interface.

I love the yellow color (citrus flavour), but I will not buy a yellow car nor wear yellow clothes…