RE: protocol and properties

2010-11-28 Thread Mario Kušnjer

   Then I implement a class which implements this protocol. To do that
I make a property:

   @property (nonatomic, readwrite, retain) NSArray * objects;

   and put the appropriate synthesize statement in the implementation. 

   I get compiler warnings that this class doesn't implement the
protocol. It seems it doesn't take the synthesized getter as being an
implementation of the -objects method.

   I also tried explicitly adding the implementation, but the warning
remains:

   - (NSArray*) objects
   {
 return objects;
   }

   Am I doing something wrong here, or is it not possible to use a
property to satisfy a protocol?

Yes, you are doing something wrong.
Here you are just using a method that you declared and implemented in a
protocol.
You need to tell a class where that method is declared and implemented, and
you do that like this:

@interface ClassIWantToUseSomeProtocolMethodIn : NSObject
MyProtocolThatIWantToImplement

Bye

Mario Kušnjer

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Question about NSScrollView

2010-02-19 Thread Mario Kušnjer

Hi all !

So I have a question on how to resolve a little issue I have with  
NSScrollView.
I have created everything programmatically (a little exploration task  
to learn and understand how to do stuff without IB).
I have an NSOutlineView enclosed in an NSScrollView (as recommended by  
documentation).
All works good except for little thing. Since NSOutlineView is not  
populated, content area is empty, but vertical scroller knob

is shown (horizontal not showed).

Question: Why ?

I googled for an answer and got some facts together but don't really  
know how to get to the solution to rectify the issue.


Facts: Scroller in this situation is shown because NSOutlineView has  
NSTableHeader shown (instantiated).
If I set NSOutlineView headerView to nil, it gets released and not  
shown in the NSScrollView, and then there is no scroller knob.


But what if I want to have NSTableHeader ?
Seams to me that if the headerView is ON, NSScrollView makes wrong  
calculation of how much is the content area big and

how much should it be shown.
I have been examining the documentation for NSScrollView and  
NSClipView and found couple of methods that has something to do  
regarding

that but I don't know to make a use of them.

If any one knows something which could point me to the solution it  
will be much appreciated.

Thanks in advance. Bye.

P.S. example picture in attachment

inline: window.jpg


Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982
mariokusnjer (at) Skype



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Question about NSScrollView

2010-02-19 Thread Mario Kušnjer


On 2010.02.19, at 11:43, Jack Carbaugh wrote:


tell your NSScrollView to setAutoHidesScrollers:yes

This should hide the scrollbars until needed.
http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Classes/NSScrollView_Class/Reference/Reference.html


That's one of the solutions. But then I could also remove headerView  
and evade the problem in the first place. What would be solution if I  
want to have
vertical scroller visible ? I'm thinking more in the way of somehow  
recalculating contentView area before it gets send to the NSClipView  
to be displayed.

Correct ? Wrong?
Thanks for suggestions.


Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982
mariokusnjer (at) Skype



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: make connections without InterfaceBuilder

2010-02-15 Thread Mario Kušnjer

Hello !

I don't know if this got answered but here is my attempt. It is just a  
basic way of programmatically setting
an object as a application delegate and programmatically creating a  
button on the applications main

window and setting it to perform an action when clicked.

I know that there are some issues about the way this is implemented  
but it points the way to go.

Since I am a newbie my self any suggestions are more than welcome.

Brief explanation follows.

In Interface Builder:
- in MainMenu.xib create generic NSObject by adding it from the Library
- select that NSObject and in the Identity Inspector make it an  
instance of our ApplicationController class

In Xcode:
- in awakeFromNib we make our self as the application delegate
- in applicationDidFinishLaunching: we tell the application to make  
the first window that it finds as main

window, because at this time there is still no main window
- then we create our button instance, set its action as a selector  
with our action method, set our self as a target of that action,
and perform all necessary initializations for our button (title, type,  
etc)

- we add our button on the main window and then release the button
- in dealloc we remove our self as being application delegate
- okButtonAction: is our button's action method that performs NSBeep()  
function


Code follows.


ApplicationController.h

#import Cocoa/Cocoa.h


@interface ApplicationController : NSObject
{

}

@end

ApplicationController.m

#import ApplicationController.h


@implementation ApplicationController

- (void)awakeFromNib
{
[NSApp setDelegate:self];
}

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[NSApp makeWindowsPerform:@selector(makeMainWindow) inOrder:NO];

	NSButton * okButton = [[NSButton alloc]  
initWithFrame:NSMakeRect(10.0, 10.0, 96.0, 32.0)];

[okButton setAction:@selector(okButtonAction:)];
[okButton setTarget:self];
[okButton setTitle:@OK];
[okButton setButtonType:0];
[okButton setBezelStyle:11];

[[[NSApp mainWindow] contentView] addSubview:okButton];
[okButton release];
}

- (void)dealloc
{
[NSApp setDelegate:nil];

[super dealloc];
}

- (void)okButtonAction:(id)sender
{
NSBeep();
}

@end


Thanks.


Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982
mariokusnjer (at) Skype



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: make connections without InterfaceBuilder

2010-02-09 Thread Mario Kušnjer


On 2010.02.09, at 08:33, Ian Jackson wrote:

Can I just clarify, are you specifically trying to do this in code  
because you want to, or because you don't know how to make the  
connections in Interface Builder?


In interface builder control drag from the control to the  
appDelegate for the action, and from the AppDelegate to the control  
for the outlet.


Sorry if you already know this.

Ian.

On 9/02/2010, at 5:03 PM, Jonathan Chacón wrote:



Please, read first post. He specifically said that he is blind.  
Obviously, he can't control-drag.


Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982
mariokusnjer (at) Skype



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Informations about Cocoa implementations of VDCP and MOS protocols

2009-12-08 Thread Mario Kušnjer

Hello to the list !

I'm wondering if anyone here ever came across of Cocoa or Objective-C  
implementations of VDCP and MOS protocols ?
Google shows no results that would give me any references and examples  
about how could (should) this be done.

I guess that nobody tried to make an open source version yet.
There are companies that have their proprietary implementations but ...
So, I would very much appreciate if anyone have any kind of  
documentation (beside official MOS protocol from their website),
references (websites), examples or anything that could help me  
learning how to implement these protocols in my Cocoa application.

Thanks in advance.
Bye

Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


copyWithZone - if anyone could explain this to me ?

2009-11-30 Thread Mario Kušnjer

Hi !

I have some trouble understanding this implementation:

- copyWithZone:(NSZone *)zone
{
ImageAndTextCell *cell = (ImageAndTextCell *)[super  
copyWithZone:zone];

cell-image = [image retain];
return cell;
}

It is from the Apple's sample code.

First question is why there is no return type declared in front of  
copyWithZone: (probable - id - type) ?
Second question is what this sign stands (means) for: - (in cell- 
image = [image retain];) ?
Could that line be written somehow different (like any other objc  
message) ?


Basically, I'm asking for a child-like explanation of this  
implementation.

Thanks for your answers in advance. Bye.


Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: copyWithZone - if anyone could explain this to me ?

2009-11-30 Thread Mario Kušnjer

cell-image is semantically identical to (*cell).image. That is, it's
directly accessing the instance variable image of the object cell



This part is what trouble's me.

cell-image = [image retain];

This could not be like this, right ?

[cell image] = [image retain];


Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: copyWithZone - if anyone could explain this to me ?

2009-11-30 Thread Mario Kušnjer

Thank you for your explanations, Clark, Jeff and Graham.

I think i will go now and read a C book (yes, I know I should have  
read it by now) because it seems to me I have been missing something.

Bye


Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSOutlineView - How to hide disclosure triangle for root nodes ?

2009-11-25 Thread Mario Kušnjer

Hello to all on the list.

I have a little question so if anyone could help me.
I'm have an outline view that has one (for now) object in root array  
that acts as a root from which all other objects derives.


\/ Root Array
 |\/ Root object
|- Child 1
|- Child 2
|--- \/ Child 3
   |--- Child 3.1
   |--- Child 3.2
|- Child 4

My question is:
How to hide the disclosure triangle in front of the Root object and  
remove indentation for it, and just that object (and later if there is  
more Root objects for them too) ?


\/ Root Array
 | Root object
|- Child 1
|- Child 2
|--- \/ Child 3
   |--- Child 3.1
   |--- Child 3.2
|- Child 4

I would like it too look like source list in Apple's Mail application  
- where it says - MAILBOXES.


I found the delegate method which is used for drawing outlineCell
- (void)outlineView:(NSOutlineView *)outlineView  
willDisplayOutlineCell:(id)cell forTableColumn: 
(NSTableColumn*)tableColumn item:(id)item


but that method does not get called if Root object is empty.

There is a method that is also used for drawing outlineCell
- (NSRect)frameOfOutlineCellAtRow:(NSInteger)row

but it is not a delegate method which means that I should subclass  
NSOutlineView to implement that behavior.


I'm trying to make it work with the delegate method (that would be my  
preferred way) but I can't make it work.

Any suggestions what to do ? And how ?

There is a zip archive of my project at http://www.box.net/crowebster-public 
 so anyone interested can download it to review my work.


P.S. additional question:

If there is number of object that are identical (just added to the  
array but not yet modified), when one item is selected and removeItem  
method is called upon it,

all identical objects are removed instead just selected object.

How to avoid that behavior (the simplest possible way) ?

Notice: All objects are instances of NSMutableDictionary.

That problem is also in the same project.

Any suggestions are appreciated.
Thanks in advance. Bye.


Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSOutlineView - How to hide disclosure triangle for root nodes ?

2009-11-25 Thread Mario Kušnjer


On 2009.11.25, at 17:20, Jens Alfke wrote:



On Nov 25, 2009, at 5:49 AM, Mario Kušnjer wrote:

How to hide the disclosure triangle in front of the Root object and  
remove indentation for it, and just that object (and later if there  
is more Root objects for them too) ?


I think what you're looking for is the delegate method
- (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item;

—Jens



Actually no, because that delegate method is implemented and it  
doesn't hide disclosure triangle and removes indentation (actually it  
makes indentation slightly different),
but draws font and cell (depending on which highlight style used)  
differently to make them look like header or title (group) for rows  
that come under its tree.


Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSOutlineView - How to hide disclosure triangle for root nodes ?

2009-11-25 Thread Mario Kušnjer

Question for Jean-Daniel and Dave

Is that delegate method in Snow Leopard ?
Because I don't see it in Leopard !

- (BOOL)outlineView:(NSOutlineView *)outlineView  
shouldShowOutlineCellForItem:(id)item;



Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSOutlineView - How to hide disclosure triangle for root nodes ?

2009-11-25 Thread Mario Kušnjer

Disregard that last question.
I have just checked online documentation on Apple Dev site.
It's Snow Leopard feature, not available in Leopard.

So, I should subclass NSOutlineView to solve my problem (on Leopard) ?

Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSOutlineView - How to hide disclosure triangle for root nodes ?

2009-11-25 Thread Mario Kušnjer

Hi !

So I have sub classed NSOutlineView and implemented single method like  
this:


- (NSRect)frameOfOutlineCellAtRow:(NSInteger)row {
return row == 0 ? NSZeroRect : [super frameOfOutlineCellAtRow:row];
}

That works except the indentation problem is still on.
If root object is empty than it is indented (default in IB is 14), but  
when I add child object to it,

root object indentation gets reset to zero (0).
How do I fix that ?

Bye.

Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSOutlineView - How to hide disclosure triangle for root nodes ?

2009-11-25 Thread Mario Kušnjer

Here's me again !

So I have found a different solution for my problem and it does not  
include subclassing NSOutlineView,

but trough the use of two delegate method.
This is my implementation:

- (NSCell *)outlineView:(NSOutlineView *)outlineView  
dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
	[outlineView rowForItem:item] == 0 ? [outlineView  
setIndentationPerLevel:0.0] : [outlineView setIndentationPerLevel:14.0];
	return nil == tableColumn ? nil : [tableColumn dataCellForRow: 
[outlineView rowForItem:item]];

}

- (void)outlineView:(NSOutlineView *)outlineView  
willDisplayOutlineCell:(id)cell forTableColumn:(NSTableColumn  
*)tableColumn item:(id)item {
	[outlineView rowForItem:item] == 0 ? [cell setTransparent:YES] :  
[cell setTransparent:NO];

}

To explain:
In both methods I ask if row in question is the root. If it is, than  
set no indentation and hide triangle,

otherwise set some indentation and show the triangle.

I believe that this is better solution than subclassing.
Still I have some issues to resolve. Work in progress.

Thanks everyone for their suggestions. If anyone is interested in  
reviewing my code,

the project is in zip archive at http://www.box.net/crowebster-public.
Bye.

Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSOutlineView - Automatically select newly added item - Help needed

2009-10-06 Thread Mario Kušnjer

Hi all !

Thanks for your replies everybody !
I have reviewed my code according to yours inputs and I found where  
the problem was.

Here's the reviewed code:

if ([lsOutlineView selectedRow]  0)
{
Parent *parent = [Parent new];  --- create new Parent 
object
NSLog(@1 - %@, parent);

		[sourceListLevelZero addObject:parent];		---	add newly created  
Parent object to the root array
		[lsOutlineView reloadItem:nil reloadChildren:YES];		---	reload  
outline view


		NSUInteger index = [lsOutlineView rowForItem:parent];		---	get the  
row index of the newly created Parent object from the outline view

NSLog(@2 - %i, index);

		NSMutableIndexSet *indexSet = [NSMutableIndexSet new];		---	create  
new empty NSMutableIndexSet object

NSLog(@3 - %@, indexSet);

		[indexSet addIndex:index];		---	add row index of the Parent object  
to the indexSet

NSLog(@4 - %@, indexSet);

		[lsOutlineView expandItem:nil expandChildren:YES];		---	expand the  
root array objects and all of their children
		[lsOutlineView selectRowIndexes:indexSet byExtendingSelection:NO];		 
---	select row with index number from the indexSet without multiple  
row selection


[parent release];   --- release parent object
[indexSet release]; --- release indexSet
}

I assume this is correct way now because it works fine.
If someone has some objections, please state your comment, I am  
interested to hear (learn).


I will (when I make this code actually do something useful) post a  
link to the list for the entire source code so anyone interested to  
review it (and point out my mistakes) will

be most welcome.
Since I have no idea how to use Instruments (and until I do) this will  
be very helpful to me in future learning.


Thanks again.
Bye !


Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982
mariokusn...@skype

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSOutlineView - Automatically select newly added item - Help needed

2009-10-06 Thread Mario Kušnjer

Again me !
Just a little update !
I packed previous code in combined message calls.
Here's how it looks now:

if ([lsOutlineView selectedRow]  0)
{
Parent *parent = [Parent new];  --- create new Parent 
object
		[sourceListLevelZero addObject:parent];		---	add newly created  
Parent object to root array

[lsOutlineView reloadItem:nil reloadChildren:YES];
[lsOutlineView expandItem:nil expandChildren:YES];  
		[lsOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex: 
[lsOutlineView rowForItem:parent]] byExtendingSelection:NO];		---	 
select row according to index from indexSet created with row index of  
outline view for item - parent

[parent release];   --- release Parent object
}

Again this works fine.
Ok, that's it.
Bye !


Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982
mariokusn...@skype

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSOutlineView - Automatically select newly added item - Help needed

2009-10-05 Thread Mario Kušnjer

Hello to the list !

Request for help regarding a little problem.
So I have this piece of code:

- (IBAction)addNewItem:(id)sender
{
if ([lsOutlineView selectedRow]  0)
{
[sourceListLevelZero addObject:[Parent new]];
[lsOutlineView reloadItem:nil reloadChildren:YES];
[lsOutlineView expandItem:nil expandChildren:YES];
		[lsOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex: 
[lsOutlineView rowForItem:[Parent new]]] byExtendingSelection:NO];

}
...
}

It is the last line that trouble's me.
It should select newly added item in the list (right ?), but it does  
not !

Or am I doing something wrong (very likely !) ?

Ok, so you got it by now that I am trying to get the behavior that  
when user clicks add button new item that appears in the list  
automatically gets selected.


Thanks for help
Bye

Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982
mariokusn...@skype

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


If someone could inspect this code and explain to me what am I doing wrong ?

2009-09-18 Thread Mario Kušnjer
 isKindOfClass:[NSDictionary class]])
{
		NSLog(@4 - item for key \nameOfShow\ is %@, [item  
objectForKey:@nameOfShow]);

return [item objectForKey:@nameOfShow];
}
if ([item isKindOfClass:[NSString class]])
{
NSLog(@4.1 - item is %@, item);
return item;
}
NSLog(@4.2 - item is not valid);
return nil;
}

#pragma mark NSOutlineView delegate methods

//- (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item
//{
//  if ([item isKindOfClass:[NSDictionary class]])
//  {
//  if ([item objectForKey:@nameOfShow])
//  {
//  NSLog(@5 - item is group);
//  return YES;
//  }
//  }
//  NSLog(@5.1 - item is not group);
//  return NO;
//}

@end

--

Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982
mariokusn...@skype

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: If someone could inspect this code and explain to me what am I doing wrong ?

2009-09-18 Thread Mario Kušnjer
  
nameOfShow is NEWS AT 10	---	And this gets called fourth time.
2009-09-18 22:21:27.461 LSOutline[244:10b] 1.1 - item number of  
children is 7
2009-09-18 22:21:27.463 LSOutline[244:10b] 2.1 - item for key  
listOfShowsRundownLists at index 0 is MONDAY

2009-09-18 22:21:27.488 LSOutline[244:10b] 3.1 - item is not expandable
2009-09-18 22:21:27.494 LSOutline[244:10b] 2.1 - item for key  
listOfShowsRundownLists at index 1 is TUESDAY

2009-09-18 22:21:27.500 LSOutline[244:10b] 3.1 - item is not expandable
2009-09-18 22:21:27.533 LSOutline[244:10b] 2.1 - item for key  
listOfShowsRundownLists at index 2 is WEDNESDAY

2009-09-18 22:21:27.565 LSOutline[244:10b] 3.1 - item is not expandable
2009-09-18 22:21:27.625 LSOutline[244:10b] 2.1 - item for key  
listOfShowsRundownLists at index 3 is THURSDAY

2009-09-18 22:21:27.629 LSOutline[244:10b] 3.1 - item is not expandable
2009-09-18 22:21:27.633 LSOutline[244:10b] 2.1 - item for key  
listOfShowsRundownLists at index 4 is FRIDAY

2009-09-18 22:21:27.662 LSOutline[244:10b] 3.1 - item is not expandable
2009-09-18 22:21:27.666 LSOutline[244:10b] 2.1 - item for key  
listOfShowsRundownLists at index 5 is SATURDAY

2009-09-18 22:21:27.671 LSOutline[244:10b] 3.1 - item is not expandable
2009-09-18 22:21:27.675 LSOutline[244:10b] 2.1 - item for key  
listOfShowsRundownLists at index 6 is SUNDAY

2009-09-18 22:21:27.681 LSOutline[244:10b] 3.1 - item is not expandable
2009-09-18 22:21:27.690 LSOutline[244:10b] 4 - item for key  
nameOfShow is NEWS AT 6	---	Probable after going through the array  
of children, parent has to be called again

2009-09-18 22:21:27.710 LSOutline[244:10b] 4.1 - item is MONDAY
2009-09-18 22:21:27.716 LSOutline[244:10b] 4.1 - item is TUESDAY
2009-09-18 22:21:27.766 LSOutline[244:10b] 4.1 - item is WEDNESDAY
2009-09-18 22:21:27.771 LSOutline[244:10b] 4.1 - item is THURSDAY
2009-09-18 22:21:27.773 LSOutline[244:10b] 4.1 - item is FRIDAY
2009-09-18 22:21:27.774 LSOutline[244:10b] 4.1 - item is SATURDAY
2009-09-18 22:21:27.775 LSOutline[244:10b] 4.1 - item is SUNDAY
2009-09-18 22:21:27.776 LSOutline[244:10b] 4 - item for key  
nameOfShow is NEWS AT 10	---	Probable after going through the array  
of children, parent has to be called again

2009-09-18 22:21:27.778 LSOutline[244:10b] 4.1 - item is MONDAY
2009-09-18 22:21:27.782 LSOutline[244:10b] 4.1 - item is TUESDAY
2009-09-18 22:21:27.798 LSOutline[244:10b] 4.1 - item is WEDNESDAY
2009-09-18 22:21:27.799 LSOutline[244:10b] 4.1 - item is THURSDAY
2009-09-18 22:21:27.801 LSOutline[244:10b] 4.1 - item is FRIDAY
2009-09-18 22:21:27.802 LSOutline[244:10b] 4.1 - item is SATURDAY
2009-09-18 22:21:27.803 LSOutline[244:10b] 4.1 - item is SUNDAY
2009-09-18 22:48:29.150 LSOutline[287:10b] 4 - item for key  
nameOfShow is NEWS AT 10	---	Now I hovered mouse pointer over the  
item and this gets called first time.
2009-09-18 22:48:29.152 LSOutline[287:10b] 4 - item for key  
nameOfShow is NEWS AT 10	---And again the second time.
2009-09-18 22:48:33.062 LSOutline[287:10b] 4.1 - item is WEDNESDAY	 
---	Now I hovered mouse pointer over the item and this gets called  
first time.
2009-09-18 22:48:33.064 LSOutline[287:10b] 4.1 - item is WEDNESDAY	 
---	And again the second time.


The Debugger has exited with status 0.
---
This is slow while expanding and collapsing. Maybe because it is  
writing to the NSLog ?

Any thoughts on this ? Anybody ?

Thanks !

Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982
mariokusn...@skype

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


splitView not rendering correctly - where am I wrong ?

2009-07-16 Thread Mario Kušnjer
Hello everyone!

So I have a little problem that I don't know how to fix so if somebody
would be kind to help and explain the solution.

Problem is that splitView displays subviews that are rendered outside from the 
visible area
of the window so therefore are clipped (not visible). They are clipped after 
the splitView
has been resized in that extend that (only right subview and/or both) subviews 
had been totally sized down.
When resized back up, top (of both subviews) and/or right part (of right 
subview) are clipped.

My guess it has something to do with bounds and/or position of subviews, but 
since I'm novice in Cocoa
and Objective-C I can't see the solution.

Here is the code that I'm using for displaying splitView.

Thanks in advance!
Mario

--

- (void)splitView:(NSSplitView *)sender 
resizeSubviewsWithOldSize:(NSSize)oldSize
{   
 NSView *leftView = [[sender subviews] objectAtIndex:0];
 NSView *rightView = [[sender subviews] objectAtIndex:1];

 float dividerThickness = [sender dividerThickness];

 NSRect splitViewFrame = [sender frame];
 NSRect leftFrame = [leftView frame];
 NSRect rightFrame = [rightView frame];

int differenceInWidth  = splitViewFrame.size.width - oldSize.width;

 leftFrame.size.height = newFrame.size.height;
 leftFrame.origin = newFrame.origin;

if (differenceInWidth  0)
{
rightFrame.size.width += differenceInWidth;
}
else if (differenceInWidth  0)
{
rightFrame.size.width += differenceInWidth;
}

 rightFrame.size.width = splitViewFrame.size.width - leftFrame.size.width - 
dividerThickness;
 rightFrame.size.height = newFrame.size.height;
 rightFrame.origin.x = newFrame.origin.x + leftFrame.size.width + 
dividerThickness;

 [leftView setFrame:leftFrame];
 [rightView setFrame:rightFrame];

[sender adjustSubviews];
[sender display];
}
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to make app login window to look like OS X user login window ?

2009-04-22 Thread Mario Kušnjer


On 2009.04.22, at 08:55, Benjamin Dobson wrote:


Although I'd appreciate it if you could in any way avoid the latter.  
I have always found them extremely annoying on OS X. If you're app  
takes a long time to load, something small and simple like what  
iWork does seems  
better.___




Thanks everyone for answering !
Actually I was thinking on making a Splash Screen until app loading  
and when ready to do some kind of transition (like cube rotate that OS  
X uses) to the login window
It wouldn't display Splash Screen for long because login window is  
simple except for network connection checking because app should be  
able to use network resources


Mario
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


How to: many users edit same file at the same time ?

2009-04-22 Thread Mario Kušnjer

Hello everyone !

Again me with another bizarre question

So I am interested how to implement a possibility that many users can  
edit same file (text, XML, sheet, database entry) at the same time ?
Forget the networking part for now and focus on the part of what to  
use for file: txt file, xml file, database ?

Witch one is more appropriate ?
How does that file gets saved when many people edit it at the same  
time ?

How to implement restrictions for some users (privileges) ?

To explain what I'm trying to figure out, is how collaborative editor  
like SubEthaEdit works (with files, file-locking, accessing, saving,  
etc)


Thanks to all in advance.

Mario
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to: many users edit same file at the same time ?

2009-04-22 Thread Mario Kušnjer

On 2009.04.23, at 03:20, Greg Guerin wrote:


Seriously, though, it's not an easy problem, and if you have to ask  
How to without even describing What Have You Tried, then it  
probably means it's too hard for you to solve simply by asking  
someone else How to.




Maybe you should consider my question as abstract one.
I'm not asking to provide me a source code as a solution to my  
question, but some explanation on how thing work, maybe some  
references on discussions

that had this topic before, perhaps a white paper on that subject.
Something that will help me to get started. I haven't provided What I  
Have Tried because I Haven't Tried at all. Because I don't know where  
to start.
Thats the reason for my post. I'm starting here. If anyone is willing  
to help.


Thank you.

Mario
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to: many users edit same file at the same time ?

2009-04-22 Thread Mario Kušnjer


On 2009.04.23, at 04:02, Greg Guerin wrote:


Use the internet.  The two simplest things to try are:
 1. Google.
 2. Wikipedia.

Searching Wikipedia for the keyword SubEthaEdit finds a nice  
article about the product itself:


 http://en.wikipedia.org/wiki/SubEthaEdit

The first link on that page is for this article:

 http://en.wikipedia.org/wiki/Collaborative_real-time_editor

which discusses some of the technical challenges, among other things.


I have read that. And even tried SubEthaEdit. Thats kind a why I even  
mentioned that product.
But that doesn't answers questions about how it is working under the  
hud, what classes, functions and methods it combines
and uses in Cocoa (read this: What framework documentation should I be  
looking for to read concerning this theme).


Thanks for your help Greg, but give me some credit. I know what Google  
is for.

Been there, done that. And now I'm here.

Mario
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to make app login window to look like OS X user login window ?

2009-04-22 Thread Mario Kušnjer


On 2009.04.23, at 04:08, Chris Hanson wrote:

You shouldn't always show a log-in panel in your application either;  
Mac OS X has the Keychain for secure storage of user credentials,  
you should only ask the user to log in to your service if there's no  
stored credential or they've done something like reset their password.


And instead of checking network connectivity, your application  
should just try to use the network and fail gracefully when it's not  
available. After all, it could go away between when you check and  
actually start using it, or while you're using it - at that point,  
what does checking get you?


Well I was thinking this way: First window that shows when you start  
the app is login window because user can't use an app if he doesn't  
log in.
And about Splash Screen: The user name and password provided in login  
window is checked against a remote database over network, so that is  
why network check is done on app launch and while
that is performed I show Splash Screen. If network resources are  
unavailable no login window is showed but instead a window that  
perform certain tasks regarding the problem (if no connection - open  
network pref, if no database - select or create database, etc).

I hope I made it a little bit clear about what I'm trying to accomplish.

Thanks to everyone

Mario
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to: many users edit same file at the same time ?

2009-04-22 Thread Mario Kušnjer


On 2009.04.23, at 04:23, Kyle Sluder wrote:


So you're asking what API should I be using?  Break it down a bit.
Think about what resources SubEthaEdit uses:

1. General application type stuff (windows, etc.)
2. Text
3. Network

Then search from there.


I realize that everything gets interconnected somehow but as I said in  
my first post, I'm not interested in the network part right now.
What I would like to find out is how to write an app using Cocoa that  
has this feature.


So yes, what API should I be using that has the ability to perform  
writing (and reading) to a file on disk (local or remote) without file- 
locking and other options
related to this subject (that enables multiple users access the same  
file at the asme time and perform actions on the same) ?


 Thanks to all

Mario
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


How to make app login window to look like OS X user login window ?

2009-04-21 Thread Mario Kušnjer

Greetings everyone !

So the question is how to make a window that doesn't have a title bar  
and borders ?

Actually I would like it to be just like user login window of OS X.

This could also go for a so called Splash Screen on app launch.

Thanks to all in advance.

Mario
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to open two nibs at app launch ? Beginners question

2009-04-13 Thread Mario Kušnjer


On 2009.04.13, at 05:40, Quincey Morris wrote:


It's not wrong at all. Separate nibs are the recommended way of  
doing this.


You may just need to tell your window controller to display its  
window. Trying adding:


[myWindowController showWindow: nil];

after you've initialized your window controller.

Incidentally, in a non-document-based application (as your appears  
to be), a good place to put code to create your window controller  
would be in your application delegate's  
applicationDidFinishLaunching: method. You say you created a window  
controller. Where *did* you put that code?


Well I did a subclass of NSWindowController in separate file  
MainWindowController.


But I actually don't understand those application delegate's concept.
How do I make something to delegate to something else (did I even get  
that right ?) ?


Application delegate would be (in my case) an object added in  
MainMenu.nib that would have MainWindowController class set to it ?
And MainWindow.nib File's Owner is also set to MainWindowController,  
right ?
That would be the connection between MainWindow.nib file and the code  
to instantiate my window controller.

I'm not sure I doing it right !

So I should put applicationDidFinishLaunching (that would be  
instance ?) method  in MainWindowController class and inside  
instantiate my window controller ?


Thanks for answering !

Mario 
___


Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to open two nibs at app launch ? Beginners question

2009-04-13 Thread Mario Kušnjer


On 2009.04.13, at 11:15, Quincey Morris wrote:


Not exactly. Make your application delegate (let's say its class is  
MyAppDelegate) separate from your window controller. So, the steps  
are:


-- write a MyAppDelegate class (subclass of NSObject)

-- in IB, drag an object into MainMenu.xib, and set its class to  
MyAppDelegate (that causes an instance to be created automatically  
when your app starts up)


-- in IB, connect the 'delegate' outlet of the (predefined)  
Application object in MainMenu.xib to the MyAppDelegate object (that  
causes your MyAppDelegate object to actually *be* the application's  
delegate)


-- in your MyAppDelegate class, add an instance variable  
mainWindowController, of class MainWindowController


-- in your MyAppDelegate class, write an  
applicationDidFinishLaunching: method something like this:


	- (void) applicationDidFinishLaunching: (NSNotification *)  
aNotification {

mainWindowController = [[MainWindowController alloc] init];
[mainWindowController showWindow: nil];
}

-- your MainWindowController's init method should look something  
like this:


- (id) init {
self = [super initWithWindowNibName: @MainWindow];
if (!self) ...
...
return self;
}

-- in IB, set the class of File's Owner in MainWindow.xib to  
MainWindowController


I may have left out something, but that's the basic idea.


It's working !
Thank you!

Tell me please should and in what cases would I keep MyAppDelegate  
separate from MainWindowController and in what not, because I kinda  
made it work all from one place:


#import Cocoa/Cocoa.h


@interface MainWindowController : NSObject
{
NSWindowController *mainWindowController;
}

@end


#import MainWindowController.h


@implementation MainWindowController

- (void) applicationDidFinishLaunching:(NSNotification *) aNotification
{
	mainWindowController = [[NSWindowController alloc]  
initWithWindowNibName:@MainWindow];

[mainWindowController showWindow:nil];
}

@end

And about delegates, so if I want to do something else now I have to  
create another object in MainMenu.nib and make it a delegate of proxy  
object Application again ?

There can be multiple delegations for one Application object ?
Or should I make one object that will be a delegate but will hold the  
code for all other stuff ?

Could you explain this to me a little bit more ?

Thanks !

Mario

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


How to open two nibs at app launch ? Beginners question

2009-04-12 Thread Mario Kušnjer

My regards to all on the list

My name is Mario and I am now to Cocoa and Objective-C so I have some  
questions which will sound trivial

to those with more experience.
Please don't refer me to documentations because I have read them and  
looked for an answer and I tried

to do it according to documentations but I still can't make it.
That is why I posting here.

The problem is:
I have MainMenu.xib with only main menu whose File's Owner is  
NSApplication.
I want to have MainWindow.xib with only a window but that will be  
launched also when the application starts.


Now you will ask why separate nibs ?
Never mind why ! I just want it that way ! Is that wrong ?

So I read the docs and it says that I need to have File's Owner for  
that nib that is external to that nib.
I tried putting NSWindowController but I don't know where and how do I  
instantiate that class ?
I tried creating a subclass of NSWindowController and using it for the  
File's Owner and according to output of
NSLog everything gets allocated and initialized but window does not  
get showed.
I starting to think that I should do something in main.m but I don't  
think that would be the right way.

I am doing something wrong so please point me the right way.

Thanks to all in advance

Mario
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com