Leopard problem: rotating buttons
Leopard problem: rotating buttons
- Subject: Leopard problem: rotating buttons
- From: Daniel Griscom <email@hidden>
- Date: Sat, 3 Nov 2007 09:43:57 -0400
I've written a program, SeisMaCalibrate, which calibrates the Sudden
Motion Sensor on the user's laptop for later use by my seismic
graphing program SeisMac. To calibrate, you have to perform three
steps with the laptop in three different physical orientations: one
sitting on its body, one sitting on its left edge, and one on its
back with the body pointing straight up.
The part I love about this (probably unique) user interface is that
for the second step, the contents of the window, with
constantly-updating text and buttons, are all rotated 90 degrees
clockwise so that they're only upright if you sit the laptop on its
left edge:
<http://www.suitable.com/temp/SeisMaCalibrateTiger.png>
Problem on Leopard: although everything works, the NSButton
backgrounds don't rotate:
<http://www.suitable.com/temp/SeisMaCalibrateLeopard.png>
Oddly, the clickable areas of the NSButtons are properly rotated.
(I'm guessing this is an obscure bug in NSButton drawing under
Leopard.)
Here's the code I use to do the rotation. I use a tab view (with no
tabs) to manage the eight screens of the calibration process, and
rotate the relevant view thusly:
NSView *viewItem = [[tabView tabViewItemAtIndex:STEP_TWO] view];
NSRect rect = [viewItem bounds];
rect.origin.x = rect.size.width;
[viewItem rotateByAngle:-90];
[viewItem setBounds:rect];
I've come up with a couple of not-so-great workarounds:
- Take screen shots of the various button states in Tiger and then
switch to using my own images to generate the buttons. ('Twould be
ugly to code and get right, and the resulting button wouldn't do that
lovely throbbing thing...)
- Build my own button class which sets up an invisible NSView
containing an NSButton. My class would route mouse events to the
private view, and then repeatedly copy the appearance of the private
view to the button's rectangle. (Again, ugly to get right, and a
performance hog.)
Any ideas? Should I use up one of my Technical Support Incidents on this?
Thanks,
Dan
--
Daniel T. Griscom email@hidden
Suitable Systems http://www.suitable.com/
1 Centre Street, Suite 204 (781) 665-0053
Wakefield, MA 01880-2400
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden