Re: Disabled button looks like enabled

2009-01-12 Thread Michael Ash
On Mon, Jan 12, 2009 at 4:06 PM, Donnie Lee wrote: >> Imagine how the thread might have gone if you had put this information >> in your original e-mail: > > No, Michael, that was a simple technical question. Dave's answer was > the best. He even helped me with focus workarounds. Some people told >

Re: Disabled button looks like enabled

2009-01-12 Thread Martin Pilkington
On 12 Jan 2009, at 7:39 pm, Donnie Lee wrote: Really, I don't like all these additional libraries that try to emulate gradient bottom bar, because they redraw these controls by itself, and I would like to use only Apple controls. Mate, honestly. Just get over this irrational fear and use BWTool

Re: Disabled button looks like enabled

2009-01-12 Thread Andy Lee
On Jan 12, 2009, at 5:59 PM, Dave DeLong wrote: Plus, this thread has been more entertaining than paying diligent attention in my Principles of Statistics class... ;) What, you're reading cocoa-dev instead of doing what you're SUPPOSED to be doing? I'd tell you how shocked I am, but my boss

Re: Disabled button looks like enabled

2009-01-12 Thread Dave DeLong
None taken. I really "got" Cocoa while working on iPhone, so understanding what ButtonCells actually do and how they work are still things I haven't gotten to yet. That's why my first idea (after understanding the question) was to go look at firstResponder stuff. Plus, this thread has bee

Re: Disabled button looks like enabled

2009-01-12 Thread Andy Lee
No offense, Dave -- you've been very generous with your time and advice (while also, of course, satisfying your own curiosity :)) -- but I personally would use I. Savant's original "too dirty" suggestion, which can be implemented in three lines: @implementation MyButton - (void)drawRect:(

Re: Disabled button looks like enabled

2009-01-12 Thread Gary L. Wade
Anyone who has been developing Apple/Mac software for more than a few years can attest that Apple occasionally changes the way that some UI elements look, in some ways very subtle and in other ways major, and relying upon a current side-effect of one UI element to look like another element can caus

Re: Disabled button looks like enabled

2009-01-12 Thread Gregory Weston
Donnie Lee wrote: Imagine how the thread might have gone if you had put this information in your original e-mail: No, Michael, that was a simple technical question. ... The problem is, that when you go to people more experienced than you are to ask a "simple technical question" and peopl

Re: Disabled button looks like enabled

2009-01-12 Thread I. Savant
On Mon, Jan 12, 2009 at 4:06 PM, Donnie Lee wrote: > Some people told me something like "Don't do it because I don't like that > you do it. Nobody said any such thing. Those who told you not to do it gave *valid technical reasons* why this is a bad idea (one of which you acknowledged) and

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
>>> Now that explains it. Take a look at NSSegmentedControl. >> >> Looks nice, but how to align an image in segment, how to implement >> imageDimsWhenDisabled and how to choose button style (I need a pop-up >> button there, I found how to add a menu to segment but triangle is not >> appears)? > > H

Re: Disabled button looks like enabled

2009-01-12 Thread Benjamin Dobson
On 12 Jan 2009, at 20:56:56, Donnie Lee wrote: Now that explains it. Take a look at NSSegmentedControl. Looks nice, but how to align an image in segment, how to implement imageDimsWhenDisabled and how to choose button style (I need a pop-up button there, I found how to add a menu to segment b

Re: Disabled button looks like enabled

2009-01-12 Thread Dave DeLong
While my answer may be "best", now that I know what you're planning to do with it, I would still suggest that you use something like Brandon's BWToolkit. Your phobia of third-party controls will just make life difficult for you. For example: you just spent 10 hours trying to replicate a

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
Kind regards and gratitude, Dave! On Mon, Jan 12, 2009 at 11:31 PM, Dave DeLong wrote: > From what I understand about responders, removing first responder guarantees > that the control will never be able to accept the focus, because accepting > the focus would make the control first responder. S

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
> Imagine how the thread might have gone if you had put this information > in your original e-mail: No, Michael, that was a simple technical question. Dave's answer was the best. He even helped me with focus workarounds. Some people told me something like "Don't do it because I don't like that you

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
> Now that explains it. Take a look at NSSegmentedControl. Looks nice, but how to align an image in segment, how to implement imageDimsWhenDisabled and how to choose button style (I need a pop-up button there, I found how to add a menu to segment but triangle is not appears)? _

Re: Disabled button looks like enabled

2009-01-12 Thread Kyle Sluder
On Mon, Jan 12, 2009 at 2:39 PM, Donnie Lee wrote: > Really, I don't like all these additional libraries that try to > emulate gradient bottom bar, because they redraw these controls by > itself, and I would like to use only Apple controls. Look at NSSegmentedControl. --Kyle Sluder _

Re: Disabled button looks like enabled

2009-01-12 Thread Dave DeLong
From what I understand about responders, removing first responder guarantees that the control will never be able to accept the focus, because accepting the focus would make the control first responder. So no; nothing would be able to make this behave as normal button. Dave On Jan 12, 2009

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
It's exactly what I need, Dave. Thank you! A small question: there is "Enable access for assistive devices" in Universal Access, what do you think, can any of these devices treat my fake button as a real button (even if the button don't accepts "first responder")? Or removing first responder from a

Re: Disabled button looks like enabled

2009-01-12 Thread I. Savant
On Mon, Jan 12, 2009 at 3:11 PM, Donnie Lee wrote: > Using gradient buttons is much easier because the controls is already > there, so I don't need to create controls by myself or use 3rd party > code. ... > Yes, but, as I said before, the controls is already there and I > planned to use them to

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
> He's also a little hung up on premature optimization. Knuth would not be > pleased. > > Donnie, > > What "system resources" are you trying to "free up" ?? And why?? Don't take it to heart. It was just a hypothesis that I can save some resources by setting the button to disabled state. People her

RE: Disabled button looks like enabled

2009-01-12 Thread Jon C. Munson II
@lists.apple.com] On Behalf Of Donnie Lee Sent: Monday, January 12, 2009 2:45 PM To: Jean-Daniel Dupas Cc: Cocoa Developers Subject: Re: Disabled button looks like enabled > Then the window object try to resolve the target responder. > > Each NSView is a responder. I really don't understand how

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
>> I planned to use it to emulate >> gradient bottom bar (under Source List control), looks like in >> Mail.app. > > Is THAT all?! :-D > > In an attempt to avoid using your own (or third-party) code that > very specifically and efficiently addresses the problem (because of > some strange phobia)

Re: Disabled button looks like enabled

2009-01-12 Thread Benjamin Dobson
On 12 Jan 2009, at 19:39:29, Donnie Lee wrote: I see there is unavoidable problem with my "fake" button and Accessibility tools which may happens. I planned to use it to emulate gradient bottom bar (under Source List control), looks like in Mail.app. I created three buttons, two gradient action

Re: Disabled button looks like enabled

2009-01-12 Thread Rob Ross
He's also a little hung up on premature optimization. Knuth would not be pleased. Donnie, What "system resources" are you trying to "free up" ?? And why?? Rob On Jan 12, 2009, at 11:47 AM, I. Savant wrote: On Mon, Jan 12, 2009 at 2:24 PM, Donnie Lee wrote: I am curious to know more about

Re: Disabled button looks like enabled

2009-01-12 Thread Michael Ash
On Mon, Jan 12, 2009 at 1:43 PM, Donnie Lee wrote: >> So what you're saying is you want a button that doesn't do anything? > > Exactly. > >> In that case, just don't hook the button's action up to anything... > > Already did it, just tried to remove this button from system observers > to save syst

Re: Disabled button looks like enabled

2009-01-12 Thread I. Savant
On Mon, Jan 12, 2009 at 2:44 PM, Donnie Lee wrote: > Are you 100% sure that disabled and enabled buttons takes > identical amount of system resources? YES. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requ

Re: Disabled button looks like enabled

2009-01-12 Thread I. Savant
On Mon, Jan 12, 2009 at 2:39 PM, Donnie Lee wrote: > I planned to use it to emulate > gradient bottom bar (under Source List control), looks like in > Mail.app. Is THAT all?! :-D In an attempt to avoid using your own (or third-party) code that very specifically and efficiently addresses the

Re: Disabled button looks like enabled

2009-01-12 Thread Dave DeLong
I'll also point out that this will work for any NSButton flavor (checkboxes, help, recessed, etc). I just did some further testing to make sure that these buttons refuse the focus, and they definitely don't accept being first responder. I created an interface with a bunch of normal button

Re: Disabled button looks like enabled

2009-01-12 Thread I. Savant
On Mon, Jan 12, 2009 at 2:24 PM, Donnie Lee wrote: >> I am curious to know more about theses "system observers". Can you explain >> us what is it ? > > Cocoa observers which sends mouse events, keyboard events etc. You should probably read this: http://developer.apple.com/DOCUMENTATION/Cocoa/C

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
> Then the window object try to resolve the target responder. > > Each NSView is a responder. I really don't understand how you're trying to > reduce system resource usage. Hmm, I don't know internals of Cocoa, I hypothesized that putting a button in a disabled state can remove focus areas handled

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
> There is a reason *why* disabled buttons have a different appearance. The > members of this list are curious as to why you would want to override that. > And yes, if you don't have a good reason they will certainly point that out. I see there is unavoidable problem with my "fake" button and Acc

Re: Disabled button looks like enabled

2009-01-12 Thread Jean-Daniel Dupas
Le 12 janv. 09 à 20:24, Donnie Lee a écrit : I am curious to know more about theses "system observers". Can you explain us what is it ? Cocoa observers which sends mouse events, keyboard events etc. Hardware event are received by the kernel that send them to the window server that forw

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
> I am curious to know more about theses "system observers". Can you explain > us what is it ? Cocoa observers which sends mouse events, keyboard events etc. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or mo

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
> But it will still visually respond to mouse clicks, which is not desired, in > my interpretation of the problem statement. [[theButton cell] > setHighlightsBy:NSNoCellMask] presumably takes care of that -- but then the > user might still be able to select the button by tabbing to it. Hmm, this

Re: Disabled button looks like enabled

2009-01-12 Thread Jean-Daniel Dupas
Le 12 janv. 09 à 19:43, Donnie Lee a écrit : So what you're saying is you want a button that doesn't do anything? Exactly. In that case, just don't hook the button's action up to anything... Already did it, just tried to remove this button from system observers to save system resources pu

Re: Disabled button looks like enabled

2009-01-12 Thread Dave DeLong
Aha, I see what you're saying. Well, I just played around with this, and subclassing an NSButton as follows will create a button that looks enabled but won't respond to mouse clicks and also won't allow users to tab to the button (ie, disallows the focus): @interface FakeButton : NSButton

Re: Disabled button looks like enabled

2009-01-12 Thread Benjamin Dobson
On 12 Jan 2009, at 18:57:54, Donnie Lee wrote: The main problem that people think that I try something stupid. Instead of technical discussion they try to teach me what should I do and how should I do it. Like a religious zombies, seriously. Donnie. If someone was trying to build a car with

Re: Disabled button looks like enabled

2009-01-12 Thread Nick Zitzmann
On Jan 12, 2009, at 11:57 AM, Donnie Lee wrote: The main problem that people think that I try something stupid. Instead of technical discussion they try to teach me what should I do and how should I do it. Like a religious zombies, seriously. But they did ask valid questions, because you are

Re: Disabled button looks like enabled

2009-01-12 Thread Robert Marini
There is a reason *why* disabled buttons have a different appearance. The members of this list are curious as to why you would want to override that. And yes, if you don't have a good reason they will certainly point that out. -rob. On Jan 12, 2009, at 1:57 PM, Donnie Lee wrote: Because

Re: Disabled button looks like enabled

2009-01-12 Thread Benjamin Dobson
On 12 Jan 2009, at 18:54:19, Donnie Lee wrote: You read too much Tolkien. It's hard to me to trace which messages sent to list and which is not because crazy lists.apple.com software didn't provide "reply-to" field and I enter "to" address manually. PS: Now only "reply to all" button. Ever h

Re: Disabled button looks like enabled

2009-01-12 Thread Andy Lee
But it will still visually respond to mouse clicks, which is not desired, in my interpretation of the problem statement. [[theButton cell] setHighlightsBy:NSNoCellMask] presumably takes care of that -- but then the user might still be able to select the button by tabbing to it. If a sing

Re: Disabled button looks like enabled

2009-01-12 Thread Robert Marini
More often than not, optimizing a user's experience should be the larger concern than worrying about an NSButton's memory footprint. -rob. On Jan 12, 2009, at 1:43 PM, Donnie Lee wrote: So what you're saying is you want a button that doesn't do anything? Exactly. In that case, just don't

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
> Because, to be blunt, it appears that you're trying to do something > stupid, and the people on this list are trying to help you find a > better way to do whatever it is that you're trying to do. The main problem that people think that I try something stupid. Instead of technical discussion they

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
You read too much Tolkien. It's hard to me to trace which messages sent to list and which is not because crazy lists.apple.com software didn't provide "reply-to" field and I enter "to" address manually. PS: Now only "reply to all" button. On Mon, Jan 12, 2009 at 9:45 PM, Andy Lee wrote: > On Jan

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
> So what you're saying is you want a button that doesn't do anything? Exactly. > In that case, just don't hook the button's action up to anything... Already did it, just tried to remove this button from system observers to save system resources putting it in disabled state.

Re: Disabled button looks like enabled

2009-01-12 Thread Michael Ash
On Mon, Jan 12, 2009 at 1:20 PM, Donnie Lee wrote: >> As others have already asked: what are you trying to accomplish? > > I try to create a disabled button that looks like enabled button > :))) It's so easy to understand, why do you ask more more and > more???!!! Because, to be blunt, it app

Re: Disabled button looks like enabled

2009-01-12 Thread Andy Lee
On Jan 12, 2009, at 1:34 PM, Donnie Lee wrote: Maybe people ask because they're trying to help? Maybe you will first think your head before ask your questions? Your questions CAN'T help to solve my problem, so please don't flood in list. Please don't reply to me on the list when I've specific

Re: Disabled button looks like enabled

2009-01-12 Thread I. Savant
On Mon, Jan 12, 2009 at 1:34 PM, Donnie Lee wrote: > That's not better than my way. ... > Maybe you will first think your head before ask your questions? Your > questions CAN'T help to solve my problem, so please don't flood in > list. Ugh ... READ: http://www.slash7.com/pages/vampires --

RE: Disabled button looks like enabled

2009-01-12 Thread Jon C. Munson II
s.apple.com [mailto:cocoa-dev-bounces+jmunson=his@lists.apple.com] On Behalf Of Donnie Lee Sent: Monday, January 12, 2009 1:21 PM To: Cocoa Developers Subject: Re: Disabled button looks like enabled > As others have already asked: what are you trying to accomplish? I try to create a dis

Re: Disabled button looks like enabled

2009-01-12 Thread Dave DeLong
So what you're saying is you want a button that doesn't do anything? In that case, just don't hook the button's action up to anything... Dave Sent from my iPod On Jan 12, 2009, at 11:32 AM, Donnie Lee wrote: That's not better than my way. I never need to handle events from this button.

Re: Disabled button looks like enabled

2009-01-12 Thread I. Savant
On Mon, Jan 12, 2009 at 1:20 PM, Donnie Lee wrote: > I try to create a disabled button that looks like enabled button > :))) It's so easy to understand, why do you ask more more and > more???!!! Seriously? A solution has already been handed to you - one which you rejected because it doe

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
> Maybe people ask because they're trying to help? Maybe you will first think your head before ask your questions? Your questions CAN'T help to solve my problem, so please don't flood in list. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Plea

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
That's not better than my way. I never need to handle events from this button. On Mon, Jan 12, 2009 at 9:28 PM, Dave DeLong wrote: > Then simply subclass NSButton, add an ivar called fakeEnabled, then override > the mouseDown and mouseUp events to do the following: ... > Do the same for mouseUp,

Re: Disabled button looks like enabled

2009-01-12 Thread Randall Meadows
On Jan 12, 2009, at 11:20 AM, Donnie Lee wrote: As others have already asked: what are you trying to accomplish? I try to create a disabled button that looks like enabled button :))) It's so easy to understand, why do you ask more more and more???!!! Because, frankly, that doesn't make a

Re: Disabled button looks like enabled

2009-01-12 Thread Dave DeLong
Then simply subclass NSButton, add an ivar called fakeEnabled, then override the mouseDown and mouseUp events to do the following: -(void)mouseDown:(NSEvent*)event{ if (fakeEnabled==NO){ [super mouseDown:event]; } } Do the same for mouseUp, and just have a getter and setter for fakeE

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
> As others have already asked: what are you trying to accomplish? I try to create a disabled button that looks like enabled button :))) It's so easy to understand, why do you ask more more and more???!!! Donnie. ___ Cocoa-dev mailing list (Cocoa-d

Re: Disabled button looks like enabled

2009-01-12 Thread Andy Lee
On Jan 12, 2009, at 12:57 PM, Donnie Lee wrote: "The button should be disabled by design. It don't intend to interact with a user at all." This is exactly the point Ricky was making. If a button never works *by design*, a button is the wrong choice for a UI element I don't like to discuss i

Re: Disabled button looks like enabled

2009-01-12 Thread I. Savant
On Mon, Jan 12, 2009 at 12:57 PM, Donnie Lee wrote: >> you'd need to override the button's >> drawing to always draw the enabled state, ignoring the control's >> actual state. > > Too "dirty" solution. > :-D That's immensely entertaining. -- I.S.

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
>> "The button should be disabled by design. It don't intend to interact >> with a user at all." > > This is exactly the point Ricky was making. If a button never works > *by design*, a button is the wrong choice for a UI element I don't like to discuss ideological part of the thing, I ask only a

Re: Disabled button looks like enabled

2009-01-12 Thread I. Savant
On Mon, Jan 12, 2009 at 12:10 PM, Donnie Lee wrote: > I again forgot that "reply" button reply to sender not to the list, > crazy lists.apple.com! Here is my answer to Ricky: > > "The button should be disabled by design. It don't intend to interact > with a user at all." This is exactly the poi

Re: Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
I again forgot that "reply" button reply to sender not to the list, crazy lists.apple.com! Here is my answer to Ricky: "The button should be disabled by design. It don't intend to interact with a user at all." Cocoa Developers On Mon, Jan 12, 2009 at 7:34 PM, Luca wrote: > I agree with Ricky.

Re: Disabled button looks like enabled

2009-01-12 Thread Luca
I agree with Ricky. Why do you need this? By the way, think the better way is to subclass the NSButton, overriding the -mouseDown method. Do not call -[super mouseDown:], and it's done - your button will not be drawed. -- Luca C. On 12 Jan 09, at 13:46, Ricky Sharp wrote: Do not do this. U

Re: Disabled button looks like enabled

2009-01-12 Thread Ricky Sharp
Do not do this. Users will be very frustrated when they cannot interact with that button. Why do you think you need this? Sent from my iPhone On Jan 12, 2009, at 5:55 AM, Donnie Lee wrote: Hi! I'd like to create a disabled button that looks like enabled. If I just set enabled to "no", I g

Disabled button looks like enabled

2009-01-12 Thread Donnie Lee
Hi! I'd like to create a disabled button that looks like enabled. If I just set enabled to "no", I got grayed button. Instead I do [[theButton cell] setHighlightsBy:NSNoCellMask]; and it looks like disabled but continues to receive events. Is there a way to make a disabled button that looks like e