On Aug 2, 2014, at 8:07 PM, Daryle Walker <[email protected]> wrote: > I’m trying out Cocoa/Objective-C programming with a web-browser app. I have > a NSDocument-based app with a WebView in the window. I have added a toolbar > with individual buttons for Back and Forward. I then added menu items for > those commands, then added ones for stop-loading, reload, and > reload-with-cache-purge. > > 1. I tried that cool combined button for Back and Forward > (NSSegmentedControl), but the entire button uses a single action to send and > a single status to have. How can I have the two halves have separate actions > and enabled/disabled states?
You don’t. Instead, you set the entire button to have one action but check
which half was clicked by querying the object like so:
- (IBAction)performInstallation:(id)sender {
NSInteger selectedCell = [sender selectedSegment];
// do something here
}
In a typical web browser setup the index 0 would be back, and 1 would be
forwards.
See here:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSSegmentedCell_Class/Reference/Reference.html
> 2. I tried individual toolbar buttons (after failing the combined version)
> for Stop and Reload, but the Stop one never enabled. The menu items versions
> do work. Is my loading just too quick for the button to enable?
Possibly. How are you enabling/disabling the button?
> 3. I call the command calling reload: “Reload” and the one calling
> reloadFromOrigin: “Reload Deeply”. Is that a good name? They share the same
> line, changing when the Option-key is down (Command-R and Command-Option-R).
> Is that a good idea? I don’t think Safari exposes the cache-clearing
> version; is there a good reason for that?
Caching is a property set on WebKit and is managed by your delegates. Thus,
WebKit cannot ignore it. You will need to code your own behavior AFAIK.
>
> When using WebKit stuff for OS X (or iOS) programs, is this list better, or
> should I use the WebKit-dev list? I think the latter feels more like
> cross-platform discussion instead of being Apple-platforms-specific.
You are building a Cocoa app, so this list is appropriate.
>
> —
> Daryle Walker
> Mac, Internet, and Video Game Junkie
> darylew AT mac DOT com
>
> _______________________________________________
>
> Cocoa-dev mailing list ([email protected])
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/sevenbitstech%40gmail.com
>
> This email sent to [email protected]
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
