IB changes not reflected
IB changes not reflected
- Subject: IB changes not reflected
- From: Ricky Sharp <email@hidden>
- Date: Fri, 12 Nov 2004 09:51:09 -0600
I have a custom IB palette now with three different types of widgets. Two derive from NSView; the other derives from NSButton/NSButtonCell. I have a custom attribute inspector for each widget.
If I create a new nib, drag in any of my widgets, and bring up the attribute inspector, I'm able to manipulate the widget. i.e. as I interact with the attribute inspector controls, live updates are performed by my widget (e.g. color changes).
If I then save the nib, quit IB and re-open that nib, things are in a strange state. While the correct attribute inspector pane is brought up for my selected widgets, making any changes are not reflected by the widget. But those changes are being written down to the nib as I can switch amongst several widget instances and see the attribute inspector's controls change.
If I set some property outside of the attribute inspector (e.g. bounds), or set any property on any of the built-in widgets (e.g. NSButton), then my widgets will redraw themselves as expected.
I was able to reproduce this with Apple's ProgressViewPalette example (see /Examples/InterfaceBuilder/ProgressViewPalette). I'm using Xcode 1.5 on Mac OS X 10.3.6 to build the project.
Here's the exact steps to reproduce with ProgressViewPalette:
* Modify the ProgressViewPalette's ProgressCell.m file as follows:
In the drawInteriorWithFrame:inView: method, change the following snippet of code from:
if (percentage > 0) {
r.size.width = NSWidth(r) * [self percentage] / 100;
[color set];
NSRectFill(r);
}
to:
r.size.width = NSWidth(r) * 50 / 100;
[color set];
NSRectFill(r);
This will make it easier to see the problem as the progress cell will always be half-filled.
* Build and install ProgressViewPalette
* Launch IB and create a new Cocoa Application nib
* In the nib's window instance, drag over a ProgressViewPalette. By default, the fill should be red. Feel free to bring up the inspector on the progress-bar itself and change the color.\
* Save the nib and quit IB
* Re-open the nib, but be careful _not_ to move the nib's main window (the window that contain the progress-bar). Bring up the inspector for the progress-bar, make sure the color-well's state is highlighted (to perform live updates) and attempt to change the color.
What you'll see is that the attribute inspectors color-well does change, but the change is not reflected by the progress-bar.
* Now, do anything to modify an attribute in the nib. You can simply move the window to change its location.
Now, color changes in the attribute inspector will perform live updates of the progress-bar.
Is there some key step that I (and apparently the Apple example) is missing?
FWIW, the "dirtyness" of the IB document is probably not to blame as if I make any attribute change to my widget, I get the "dirty" dot in the document's close box. It's just that until "prodded", my widgets will not redraw themselves.
TIA,
Rick Sharp
Instant Interactive(tm)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden