Note that there are some explanatory texts on larger screens.

plurals
  1. POHow could I access a variable from a class with a method from another class?
    primarykey
    data
    text
    <p>Hi my english is not very good, so i'll try my best to explain my problem I'm new with cocoa and xcode so maybe my problem is easier than i think</p> <p>I have class , that's basically is a formulary for register client information, there i defined a method - (void)searcht:(NSString*)s; this method make a query to the database where the code = s</p> <pre><code>- (void) searcht:(NSString *)s{ PGSQLConnection *connection1= [[PGSQLConnection alloc] init]; NSString *cmd=[[NSString alloc] initWithFormat:@"select * from oc_master_customer where customer_id=%@",s ]; NSLog(@"%@", cmd); if ([connection1 connect]){ NSLog(@" ENTRO %@", [connection1 lastError]); PGSQLRecordset *rs1 = [connection1 open:cmd]; if (![rs1 isEOF]) { NSLog(@" ENTRO 2 %@", [connection1 lastError]); [matchcode setStringValue: [[rs1 fieldByName:@"matchcode"] asString]]; NSLog(@" MATCHCODE %@", [matchcode stringValue]); NSLog(@" MATCHCODE 2 %@", [[rs1 fieldByName:@"matchcode"] asString]); [name1 setStringValue: [[rs1 fieldByName:@"name1"] asString]]; [zip setStringValue: [[rs1 fieldByName:@"zip"] asString]]; [bank_code setStringValue: [[rs1 fieldByName:@"bank_code"] asString]]; [bank_account setStringValue: [[rs1 fieldByName:@"bank_account"] asString]]; [bank_name setStringValue: [[rs1 fieldByName:@"bank_name"] asString]]; [bank_iban setStringValue: [[rs1 fieldByName:@"bank_iban"] asString]]; [bank_swift setStringValue: [[rs1 fieldByName:@"bank_swift"] asString]]; [city setStringValue: [[rs1 fieldByName:@"city"] asString]]; [city_part setStringValue: [[rs1 fieldByName:@"citypart"] asString]]; [street setStringValue: [[rs1 fieldByName:@"street"] asString]]; [country setStringValue: [[rs1 fieldByName:@"country_code"] asString]]; } [connection1 close]; [rs1 close];} } </code></pre> <p>I use this method with a NSSearchfield and it worked perfectly, now i made a subclass of nsearchfield and i want to call this method when the user pressed enter, i could access to the method but i can't change the string values from the IBOutlets. I already have declared the IBOutlets as @public. My code from the nssearchfiel subclass </p> <pre><code>-(void)keyUp:(NSEvent*)event { if ([event keyCode]==36){ [[self window] selectKeyViewFollowingView:self]; customers* c= [[customers alloc] init]; NSLog(@"Key released: %@",[self stringValue]); [c searcht:[self stringValue]]; } } </code></pre> <p>My problem is that the method i defined doesn't do a thing if i called from other class somebody have an idea of that what i have to do or i missing</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload