Post

Replies

Boosts

Views

Activity

To pop up an alert window with larger text with red color
NSRunAlertPanel has been used to alert user like the following: dispatch_sync(dispatch_get_main_queue(), ^{                     NSRunAlertPanel(@"Note", @"Please put RED sticker on DUT!", @"OK", nil, nil);                 }); It continues the following process after clicking button "OK" I'd like to enlarger the text size and change the text color, but there is no related parameter in NSRunAlertPanel. How could I do?
0
0
508
Oct ’22
Notice user and terminate the program when exit button is pressed. Ask yes or no. Yes to close the app. No to continue the program
Language: Objective C Just like the title, I wanna implement the functionality that can keep user from clicking the exit button by mistake. And it should show some words together like this: "Do you want to close the program?" Button "Yes", Button "No" Is any method I can use? Thank in advance. Where should I put this code?And how to make the actions of those buttons in alert window?
1
0
401
Jul ’22
EXC_BAD_INSTRUCTION on dispatch_sync()
The following is my code to show text in textview. But the error, EXC_BAD_INSTRUCTION, happens while executing it. How does this error happen and how could I fix it? dispatch_sync(dispatch_get_main_queue(), ^{ [[[Memo1 textStorage] mutableString]appendString:[NSString stringWithFormat:@"%@", str]]; [Memo1 scrollRangeToVisible:NSMakeRange(Memo1.string.length, 0)];//auto scroll down });
4
0
1.4k
Jun ’22
error: "No module named pyvisa_py" in Xcode. This error doesn't happen running the command directly in terminal.
IDE: Xcode I have the following code in my program sending this command in terminal. Program hangs up on this line and the debug area shows error "no module named pyvisa_py". (power_max.py import the pyvisa module) Then I try this command in terminal directly and the module pyvisa_py, installed already, can be found. The python file can be executed successfully. How could I make Xcode identify the pyvisa_py module? [cmd appendString:@“python3 /Users/shared/power_max.py”];     [cmd appendString:[Paremeter_IP stringValue]];     [cmd appendString:@" > /users/Shared/CMW.txt"];     system([cmd UTF8String]);
0
0
603
Jun ’22
Thread1: EXE_BAD_INSTRUTION. How does this error show up, I just removed some line that are not important?
I have a button that starts tests. The items, test no, min and max are added to the table_array and refresh table to show them. Following code runs without error. index++; //if([[Elect objectAtIndex:index]isEqualToString:@"1"]) item++; temp = [self GetDCVoltage_34970:1]; if(temp >= [[Min objectAtIndex:index]floatValue] && temp <= [[Max objectAtIndex:index]floatValue]) [table_status addObject:@"Pass"]; else { PF=false; [table_status addObject:@"Fail"]; err=101+item; [errcode setIntValue:err]; } [table_no addObject:[NSString stringWithFormat:@"%d",item]]; [self Show_Datagrid:index]; [table_value addObject:[NSString stringWithFormat:@"%.3f",temp]]; [Test_value replaceObjectAtIndex:index withObject:[NSString stringWithFormat:@"%.3f",temp]]; [self refreshTable]; //if (continue_test.state==0 && PF==false) //return; return; After I removed some lines, I only remain the lines that add objects to table_array. Then it shows up error: Thread1: EXE_BAD_INSTRUTION after I pressed button. [table_no addObject:[NSString stringWithFormat:@"%d",item]]; [self Show_Datagrid:index]; [table_value addObject:[NSString stringWithFormat:@"%.3f",temp]]; [Test_value replaceObjectAtIndex:index withObject:[NSString stringWithFormat:@"%.3f",temp]]; [self refreshTable];
1
0
519
May ’22
Table column cannot show value with function tableView:aTableView objectValueForTableColumn:aTableColumn row:rowIndex
I hope the table column show the values after I pressed the button. The following is the IBAction Button. - (IBAction)buttonTapped:(id)sender { //Filling the arrays Test_name = [NSArray arrayWithObjects:@"test_item_a",@"b",@"c",@"Current",nil]; Min = [NSArray arrayWithObjects:@"0.5",@"0.7",@"0.8",@"100",nil]; Max = [NSArray arrayWithObjects:@"5",@"5",@"9",@"140",nil]; uint16 index = 0; NSInteger i = 0; //Show_Datagrid this function move the above values to another 3 arrays table_item, //table_min, table_max. And the following code is just to verify the value. [self Show_Datagrid:index]; [self showMeg:@"Button Tapped!2\n"]; [self showMeg:[table_item objectAtIndex:0]]; [self showMeg:@"\n"]; [self showMeg:[table_min objectAtIndex:0]]; [self showMeg:@"\n"]; [self showMeg:Column_test_item.identifier]; //call this function to show the values in tableview. [self tableView:_tableview objectValueForTableColumn:Column_test_item row:i]; } following is the function (Column_test_item.identifier is verified correct.): -(id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { if ([aTableColumn.identifier isEqualToString:@"no"]) return [table_no objectAtIndex:rowIndex]; if ([aTableColumn.identifier isEqualToString:@"item"]) return [table_item objectAtIndex:rowIndex]; if ([aTableColumn.identifier isEqualToString:@"min"]) return [table_min objectAtIndex:rowIndex]; if ([aTableColumn.identifier isEqualToString:@"max"]) return [table_max objectAtIndex:rowIndex]; if ([aTableColumn.identifier isEqualToString:@"value"]) return [table_value objectAtIndex:rowIndex]; if ([aTableColumn.identifier isEqualToString:@"status"]) return [table_status objectAtIndex:rowIndex]; return [table_no objectAtIndex:rowIndex]; } I thnik I called that function in wrong way. Shouldn't I input NSTableColumn parameter Column_test_item directly? Column_test_item is an IBOutlet I connected to the specfic test item column. And how does this function know which column it want to fill up the value, based on the second parameter I input?
1
0
625
May ’22
Show-message function got error: Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
Show-message function got error: Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) following is the function. -(void)showMeg:(NSString *)str { dispatch_sync(dispatch_get_main_queue(), ^{ [[[Memo1 textStorage] mutableString]appendString:[NSString stringWithFormat:@"%@", str]]; [Memo1 scrollRangeToVisible:NSMakeRange(Memo1.string.length, 0)];//auto scroll down }); } I called it in other .m file like the following. -(void)showMeg:(NSString *)str { dispatch_sync(dispatch_get_main_queue(), ^{ [[[Memo1 textStorage] mutableString]appendString:[NSString stringWithFormat:@"%@", str]]; [Memo1 scrollRangeToVisible:NSMakeRange(Memo1.string.length, 0)];//auto scroll down }); }
1
0
797
May ’22
To pop up an alert window with larger text with red color
NSRunAlertPanel has been used to alert user like the following: dispatch_sync(dispatch_get_main_queue(), ^{                     NSRunAlertPanel(@"Note", @"Please put RED sticker on DUT!", @"OK", nil, nil);                 }); It continues the following process after clicking button "OK" I'd like to enlarger the text size and change the text color, but there is no related parameter in NSRunAlertPanel. How could I do?
Replies
0
Boosts
0
Views
508
Activity
Oct ’22
Notice user and terminate the program when exit button is pressed. Ask yes or no. Yes to close the app. No to continue the program
Language: Objective C Just like the title, I wanna implement the functionality that can keep user from clicking the exit button by mistake. And it should show some words together like this: "Do you want to close the program?" Button "Yes", Button "No" Is any method I can use? Thank in advance. Where should I put this code?And how to make the actions of those buttons in alert window?
Replies
1
Boosts
0
Views
401
Activity
Jul ’22
EXC_BAD_INSTRUCTION on dispatch_sync()
The following is my code to show text in textview. But the error, EXC_BAD_INSTRUCTION, happens while executing it. How does this error happen and how could I fix it? dispatch_sync(dispatch_get_main_queue(), ^{ [[[Memo1 textStorage] mutableString]appendString:[NSString stringWithFormat:@"%@", str]]; [Memo1 scrollRangeToVisible:NSMakeRange(Memo1.string.length, 0)];//auto scroll down });
Replies
4
Boosts
0
Views
1.4k
Activity
Jun ’22
error: "No module named pyvisa_py" in Xcode. This error doesn't happen running the command directly in terminal.
IDE: Xcode I have the following code in my program sending this command in terminal. Program hangs up on this line and the debug area shows error "no module named pyvisa_py". (power_max.py import the pyvisa module) Then I try this command in terminal directly and the module pyvisa_py, installed already, can be found. The python file can be executed successfully. How could I make Xcode identify the pyvisa_py module? [cmd appendString:@“python3 /Users/shared/power_max.py”];     [cmd appendString:[Paremeter_IP stringValue]];     [cmd appendString:@" > /users/Shared/CMW.txt"];     system([cmd UTF8String]);
Replies
0
Boosts
0
Views
603
Activity
Jun ’22
Thread1: EXE_BAD_INSTRUTION. How does this error show up, I just removed some line that are not important?
I have a button that starts tests. The items, test no, min and max are added to the table_array and refresh table to show them. Following code runs without error. index++; //if([[Elect objectAtIndex:index]isEqualToString:@"1"]) item++; temp = [self GetDCVoltage_34970:1]; if(temp >= [[Min objectAtIndex:index]floatValue] && temp <= [[Max objectAtIndex:index]floatValue]) [table_status addObject:@"Pass"]; else { PF=false; [table_status addObject:@"Fail"]; err=101+item; [errcode setIntValue:err]; } [table_no addObject:[NSString stringWithFormat:@"%d",item]]; [self Show_Datagrid:index]; [table_value addObject:[NSString stringWithFormat:@"%.3f",temp]]; [Test_value replaceObjectAtIndex:index withObject:[NSString stringWithFormat:@"%.3f",temp]]; [self refreshTable]; //if (continue_test.state==0 && PF==false) //return; return; After I removed some lines, I only remain the lines that add objects to table_array. Then it shows up error: Thread1: EXE_BAD_INSTRUTION after I pressed button. [table_no addObject:[NSString stringWithFormat:@"%d",item]]; [self Show_Datagrid:index]; [table_value addObject:[NSString stringWithFormat:@"%.3f",temp]]; [Test_value replaceObjectAtIndex:index withObject:[NSString stringWithFormat:@"%.3f",temp]]; [self refreshTable];
Replies
1
Boosts
0
Views
519
Activity
May ’22
Table column cannot show value with function tableView:aTableView objectValueForTableColumn:aTableColumn row:rowIndex
I hope the table column show the values after I pressed the button. The following is the IBAction Button. - (IBAction)buttonTapped:(id)sender { //Filling the arrays Test_name = [NSArray arrayWithObjects:@"test_item_a",@"b",@"c",@"Current",nil]; Min = [NSArray arrayWithObjects:@"0.5",@"0.7",@"0.8",@"100",nil]; Max = [NSArray arrayWithObjects:@"5",@"5",@"9",@"140",nil]; uint16 index = 0; NSInteger i = 0; //Show_Datagrid this function move the above values to another 3 arrays table_item, //table_min, table_max. And the following code is just to verify the value. [self Show_Datagrid:index]; [self showMeg:@"Button Tapped!2\n"]; [self showMeg:[table_item objectAtIndex:0]]; [self showMeg:@"\n"]; [self showMeg:[table_min objectAtIndex:0]]; [self showMeg:@"\n"]; [self showMeg:Column_test_item.identifier]; //call this function to show the values in tableview. [self tableView:_tableview objectValueForTableColumn:Column_test_item row:i]; } following is the function (Column_test_item.identifier is verified correct.): -(id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { if ([aTableColumn.identifier isEqualToString:@"no"]) return [table_no objectAtIndex:rowIndex]; if ([aTableColumn.identifier isEqualToString:@"item"]) return [table_item objectAtIndex:rowIndex]; if ([aTableColumn.identifier isEqualToString:@"min"]) return [table_min objectAtIndex:rowIndex]; if ([aTableColumn.identifier isEqualToString:@"max"]) return [table_max objectAtIndex:rowIndex]; if ([aTableColumn.identifier isEqualToString:@"value"]) return [table_value objectAtIndex:rowIndex]; if ([aTableColumn.identifier isEqualToString:@"status"]) return [table_status objectAtIndex:rowIndex]; return [table_no objectAtIndex:rowIndex]; } I thnik I called that function in wrong way. Shouldn't I input NSTableColumn parameter Column_test_item directly? Column_test_item is an IBOutlet I connected to the specfic test item column. And how does this function know which column it want to fill up the value, based on the second parameter I input?
Replies
1
Boosts
0
Views
625
Activity
May ’22
What does the circle mean in front of the line?
What does the circle mean in front of the line (following image)? How could I remove or create it?
Replies
2
Boosts
0
Views
1.2k
Activity
May ’22
Show-message function got error: Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
Show-message function got error: Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) following is the function. -(void)showMeg:(NSString *)str { dispatch_sync(dispatch_get_main_queue(), ^{ [[[Memo1 textStorage] mutableString]appendString:[NSString stringWithFormat:@"%@", str]]; [Memo1 scrollRangeToVisible:NSMakeRange(Memo1.string.length, 0)];//auto scroll down }); } I called it in other .m file like the following. -(void)showMeg:(NSString *)str { dispatch_sync(dispatch_get_main_queue(), ^{ [[[Memo1 textStorage] mutableString]appendString:[NSString stringWithFormat:@"%@", str]]; [Memo1 scrollRangeToVisible:NSMakeRange(Memo1.string.length, 0)];//auto scroll down }); }
Replies
1
Boosts
0
Views
797
Activity
May ’22
xcode13.3.1. Where can I find interface builder? I want to add a text column.
xcode version: 13.3.1 Where can I find interface builder? I want to add a text column.
Replies
1
Boosts
0
Views
571
Activity
May ’22