0

Hello there I am trying to make a NSComboBox transparent but its not working. I am trying it with the following method:

[NSComboBox setTransparent:YES];

But it seems that NSComboBox doesn't implement setTransparent neither does NSComboBoxCell nor NSTextField. Looking forward to your suggestions and answers.

Regards Umair

August Lilleaas
  • 54,010
  • 13
  • 102
  • 111
Omayr
  • 1,949
  • 4
  • 22
  • 35

2 Answers2

3

[comboBox setHidden:1];

justin
  • 104,054
  • 14
  • 179
  • 226
  • @invariant because `0`/`1` are clear as substitutions for `NO`/`YES`. the change originated from compiling many sources as objc++. with the warning set i use (very high), c-style casts are flagged as warnings in c++/objc++ translations (because c++ has its own way of casting). that means that every use of `NO`/`YES` visible to an objc++ translation would generate a warning because these constants are defined as `#define NO (BOOL)0` and `#define YES (BOOL)1`. i also use `0`/`1` instead of `true`/`false`, and `0` instead of `nil`, `NULL`, etc. – justin Nov 01 '10 at 22:06
  • 1
    I'd argue, however, that it's far clearer to answer an Objective-C question with code that follows established Objective-C conventions to avoid confusion. – Joshua Nozzi Nov 02 '10 at 13:50
0

I'll add in addition to Justin's answer that you should specify why you want to do this. The reasons for your goal can mean the difference between using -setHidden: and, say, setting the control to have no bezel.

Additionally, it's very un-Mac-like to have UI that hides controls. It's almost always the right choice to disable a control if it is unavailable because of some other state. Alternatively, if you're switching subsets of controls based on a choice, consider using an NSTabView without tabs.

Joshua Nozzi
  • 60,946
  • 14
  • 140
  • 135