Hello, I am using Matt Gemells status item code and I am having rouble switching between two views.
I have created an array that holds both NSViews that I want to switch to and a integer with the value of 0 in it.
What I was trying to do was to create a button that, when pressed, changed the value of the integer to 1.
It worked, but you must open and close the window for it to work properly.
How would I make it work so that it switches instantly?
Code:
I have created an array that holds both NSViews that I want to switch to and a integer with the value of 0 in it.
What I was trying to do was to create a button that, when pressed, changed the value of the integer to 1.
It worked, but you must open and close the window for it to work properly.
How would I make it work so that it switches instantly?
Code:
Code:
- (void)toggleAttachedWindowAtPoint:(NSPoint)pt
{
// Attach/detach window.
if (!attachedWindow) {
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
attachedWindow = [[MAAttachedWindow alloc] initWithView:[arrayviews objectAtIndex:viewhold]
attachedToPoint:pt
inWindow:nil
onSide:MAPositionAutomatic
atDistance:5.0];
[attachedWindow makeKeyAndOrderFront:self];
} else {
[attachedWindow setAlphaValue:1.0];
[[attachedWindow animator] setAlphaValue:0.0];
//[attachedWindow orderOut:self];
[attachedWindow release];
attachedWindow = nil;
}
}
-(IBAction)openprefs:(id)sender {
viewhold = 1;
}