Ask a Question related to Mac Programming, Design and Development.
-
Michael Ash #1
Re: [COCOA] Dynamic button?
In article <1fzrife.s6p9421wrpd7mN%usenet@mile23.com>,
[email]usenet@mile23.com[/email] (Paul Mitchum) wrote:
This will only work if the button actually becomes the window's first> The Cocoa docs say that NSResponder (one of NSButton's superclasses)
> receives -(void)flagsChanged:(NSEvent *)theEvent when the user presses
> or releases a modifier key. So your NSButton subclass should include
> something like this: (Untested code alert!)
>
> -(void)flagsChanged:(NSEvent *)theEvent
> {
> if ([theEvent modifierFlags] && NSAlternateKeyMask) {
> // option key is pressed, so change the button.
> }
> else {
> // option key isn't pressed
> }
> }
responder. This is unlikely to happen, and doesn't really make sense for
this. The first responder is supposed to be the current active control,
whereas the OP wants to be able to have this button work at any time, as
far as I can see.
You may be able to implement flagsChanged: in your window's delegate, I
think the delegate becomes part of the responder chain. If it doesn't,
then you'll probably need a custom subclass of NSWindow. In either case,
you can modify the button from there.
Michael Ash Guest
-
Making a dynamic button
I am bringing into flash xml files via a web service connector and a data set component. Bound to these are are various components to retreive... -
Button with Dynamic Textfield?
I've got a button called "areaButton_btn" and inside that button is a dynamic textfield called "buttonTitle_txt". This textfield is on all the... -
dynamic button - does not go to handler
Hi here is what I am doing - building a table dynamically HtmlTableRow objRow = new HtmlTableRow(); tblStuff.Rows.Add(objRow); ... -
How to select a button in a matrix of push button (Cocoa) ?
The radion button was created with Interface Builder. How to make a default (selected) button in this matrix ? -
Dynamic ASP.NET button control
Victor, That's the missing link. Thank You! -Todd "Victor Garcia Aprea " <vga@NOobiesSPAM.com> wrote in message... -
Joost Egelie #2
Re: [COCOA] Dynamic button?
In article <mail-EB9C11.09143916082003@localhost>,
Michael Ash <mail@mikeash.com> wrote:
[snip]Thanks, I'll try to get it working. With the knowledge provided,> This will only work if the button actually becomes the window's first
> responder. This is unlikely to happen, and doesn't really make sense for
> this. The first responder is supposed to be the current active control,
> whereas the OP wants to be able to have this button work at any time, as
> far as I can see.
>
> You may be able to implement flagsChanged: in your window's delegate, I
> think the delegate becomes part of the responder chain. If it doesn't,
> then you'll probably need a custom subclass of NSWindow. In either case,
> you can modify the button from there.
shouldn't be _too_ hard.
Apropos, hasn't anyone doen something like this before? I can't remember
the apps/Finder-features I've seen this, but I know it is part of
Apple's apps... AFAIK, a similar thing is done with the menubars in the
Finder, i.e. the Minimize menu item.
Problem is, I have a combobox, with dates in them. A user can add a date
by typing it in, and then push the button "Save" underneath it. In order
to remove the date, I wanted to let the user press down the option key,
thus changing the button into "Delete". I have very little room in this
window, so any other angles of approach are welcome.
--
Joost Egelie
[email]nospam@wanadoo.be[/email]
Please replace "nospam" with "jegelie" in my e-mail address when
answering by mail.
Joost Egelie Guest
-
Michael Ash #3
Re: [COCOA] Dynamic button?
In article <nospam-DAEB34.10165617082003@sinclair.be.wanadoo.com>,
Joost Egelie <nospam@wanadoo.be> wrote:
I'm not a big fan of combo boxes to begin with, so I would personally> Thanks, I'll try to get it working. With the knowledge provided,
> shouldn't be _too_ hard.
>
> Apropos, hasn't anyone doen something like this before? I can't remember
> the apps/Finder-features I've seen this, but I know it is part of
> Apple's apps... AFAIK, a similar thing is done with the menubars in the
> Finder, i.e. the Minimize menu item.
>
> Problem is, I have a combobox, with dates in them. A user can add a date
> by typing it in, and then push the button "Save" underneath it. In order
> to remove the date, I wanted to let the user press down the option key,
> thus changing the button into "Delete". I have very little room in this
> window, so any other angles of approach are welcome.
prefer an alternate approach, but I can't think of any that would be as
small. So, why are your space constraints so tight? Screens are bigger
now, OS X "requires" 800x600 (but runs in less). Can you really not
spare a few extra pixels for an extra button?
If you really can't, one possible alternative would be to have two
buttons, but very small. Change Save to "+", and change Delete to "-".
You should be able to squeeze that into the same space as one Save
button. Hopefully people should be able to figure out what they mean,
and it may be a bit more obvious how to delete things than the option
key trick. Of course I'm sure you'd document it, but people seem to skip
reading the docs too often.
Michael Ash Guest
-
Joost Egelie #4
Re: [COCOA] Dynamic button?
In article <mail-7C0EFF.09565917082003@localhost>,
Michael Ash <mail@mikeash.com> wrote:
[snip]Yes, people do that nowadays :-)> I'm not a big fan of combo boxes to begin with, so I would personally
> prefer an alternate approach, but I can't think of any that would be as
> small. So, why are your space constraints so tight? Screens are bigger
> now, OS X "requires" 800x600 (but runs in less). Can you really not
> spare a few extra pixels for an extra button?
>
> If you really can't, one possible alternative would be to have two
> buttons, but very small. Change Save to "+", and change Delete to "-".
> You should be able to squeeze that into the same space as one Save
> button. Hopefully people should be able to figure out what they mean,
> and it may be a bit more obvious how to delete things than the option
> key trick. Of course I'm sure you'd document it, but people seem to skip
> reading the docs too often.
I think I use a whole different approach - that of a document structure.
"New, Save, Load, Delete" and such go into the menubar, I can get rid of
the combobox and have the date stated in a plain non-editable textfield
or even the window's titlebar, and I have room to spare.
The document I have is fairly big - it's a 6/42 Lotto-form from Belgium.
Those "bulletins" are made of 12 grids of 42 numbers. I managed to make
a sort of "grid"-control, which lets the user tag 6 numbers and provide
visual feedback to wether 6 number have been tagged. Although, with 12
of those, the window is pretty blocked up. And slow in display updates.
But that I'll probably straighten out in time.
Thanks for the advice though!
--
Joost Egelie
[email]nospam@wanadoo.be[/email]
Please replace "nospam" with "jegelie" in my e-mail address when
answering by mail.
Joost Egelie Guest
-
Simon Slavin #5
Re: [COCOA] Dynamic button?
In article <nospam-DAEB34.10165617082003@sinclair.be.wanadoo.com>,
Joost Egelie <nospam@wanadoo.be> wrote:
AppleWorks does it (but bear in mind that AppleWorks is written>Apropos, hasn't anyone doen something like this before?
in Carbon, not Cocoa). If you try to close a document you've
edited you get up the normal Don't Save/Cancel/Save dialog. If
you hold down the Command key the names on the buttons change
to show that, for example, command-D means 'Don't Save'.
Simon Slavin Guest
-
Joost Egelie #6
Re: [COCOA] Dynamic button?
In article <BB670ED29668490CDB@10.0.1.2>,
[email]slavins@hearsay.demon.co.uk[/email]@localhost (Simon Slavin) wrote:
> In article <nospam-DAEB34.10165617082003@sinclair.be.wanadoo.com>,
> Joost Egelie <nospam@wanadoo.be> wrote:
>>> >Apropos, hasn't anyone doen something like this before?
> AppleWorks does it (but bear in mind that AppleWorks is written
> in Carbon, not Cocoa). If you try to close a document you've
> edited you get up the normal Don't Save/Cancel/Save dialog. If
> you hold down the Command key the names on the buttons change
> to show that, for example, command-D means 'Don't Save'.
>
>
Yes, I know. But this behaviour was seen under Classic too.
An example of this in (I presume) Cocoa, is in the prefpane "Startup
Disk". Press down Option, and the three dots in the "Restart" button
disappear. Not always though, so I guess it is fairly hard to code such
a thing. The prefpane seems to have "acceptsFirstResponder" issues, in
my opinion...
--
Joost Egelie
[email]nospam@wanadoo.be[/email]
Please replace "nospam" with "jegelie" in my e-mail address when
answering by mail.
Joost Egelie Guest
-
Mark Haase #7
Re: [COCOA] Dynamic button?
In article <nospam-5F9566.09340023082003@sinclair.be.wanadoo.com>,
Joost Egelie <nospam@wanadoo.be> wrote:
I was unable to replicate this.> An example of this in (I presume) Cocoa, is in the prefpane "Startup
> Disk". Press down Option, and the three dots in the "Restart" button
> disappear. Not always though, so I guess it is fairly hard to code such
> a thing. The prefpane seems to have "acceptsFirstResponder" issues, in
> my opinion...
Mark Haase Guest
-
Joost Egelie #8
Re: [COCOA] Dynamic button?
In article <mehaase-D8A2F7.10470324082003@netnews.upenn.edu>,
Mark Haase <mehaase@earthlink.net> wrote:
> In article <nospam-5F9566.09340023082003@sinclair.be.wanadoo.com>,
> Joost Egelie <nospam@wanadoo.be> wrote:
>>> > An example of this in (I presume) Cocoa, is in the prefpane "Startup
> > Disk". Press down Option, and the three dots in the "Restart" button
> > disappear. Not always though, so I guess it is fairly hard to code such
> > a thing. The prefpane seems to have "acceptsFirstResponder" issues, in
> > my opinion...
> I was unable to replicate this.
As I said: not always... Sometimes it helps to click in the Finder, and
then back in the prefpane. Or close it and open it again. Or perhaps you
have another version. Mine is Jaguar, 10.2.6.
But I turned the whole interface upside down and inside out, so I don't
have need for dynamic buttons now. I manage the more document-based
structure now via menu calls.
--
Joost Egelie
[email]nospam@wanadoo.be[/email]
Please replace "nospam" with "jegelie" in my e-mail address when
answering by mail.
Joost Egelie Guest



Reply With Quote

