|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Apprentice |
hi, i'm new with fscript, can some1 help with this? daylite crashes eachtime i click on the button. i tried this script on a normal fscript-console & it works quite well ( just change NSPupupButtons items for something else instead if getting it from DB:
"Instantiate and configure a window" window := NSWindow alloc initWithContentRect styleMask:NSTitledWindowMask + NSClosableWindowMask + NSMiniaturizableWindowMask backing:NSBackingStoreBuffered defer:NO. "Put the window onscreen" window orderFront:nil. "Give a title to the window" window setTitle:'Test'. "Instantiate a form object" form := NSForm alloc initWithFrame "Put the form into the window" window contentView addSubview:form. "Configure the form" popup := NSPopUpButton alloc initWithFrame cats := objectContext objectsForEntityNamed:'Category'. catCount := cats count. msg:='get' ++ (catCount description) ++ 'categories' ++ '\n'. index:= 0. [index < catCount] whileTrue: [ cat := cats objectAtIndex:index. catName := cat name. popup addItemWithTitle:catName. msg := msg ++ (catName) ++ '\n'. index:= index + 1. ]. "button" button := NSButton alloc initWithFrame window contentView addSubview:button. button setBezelStyle:NSRoundedBezelStyle. button setTitle:'get Contacts'. "label" text := NSTextField alloc initWithFrame text setEditable:YES. text setStringValue:'test'. catSelected := [ text setStringValue: (popup titleOfSelectedItem). ]. window contentView addSubview window contentView addSubview:text. button setTarget: catSelected. button setAction:#value:. --- thanx |
||
|
|
Marketcircle Team |
Sorry for the delay in answering this.
After correcting a few syntax thing (because of the html), it seems to render fine for me. I'm not sure what you want to accomplish though. From the looks of it, a plugin might be better because I think you will need a couple of classes. Add classes in F-Script is not easy however (there are ways, but it is not for the faint of heart). Here is my cleaned up code: "Instantiate and configure a window" window := NSWindow alloc initWithContentRect:(125<>513 extent:383<>175) styleMask:NSTitledWindowMask + NSClosableWindowMask + NSMiniaturizableWindowMask backing:NSBackingStoreBuffered defer:NO. "Put the window onscreen" window orderFront:nil. "Give a title to the window" window setTitle:'Test'. "Instantiate a form object" form := NSForm alloc initWithFrame:(15<>70 extent:348<>85). "Put the form into the window" window contentView addSubview:form. "Configure the form" popup := NSPopUpButton alloc initWithFrame:(20<>20 extent:200<>100) pullsDown:NO. cats := objectContext objectsForEntityNamed:'Category'. catCount := cats count. msg:='get' ++ (catCount description) ++ 'categories' ++ '\n'. index:= 0. [index < catCount] whileTrue: [ cat := cats objectAtIndex:index. catName := cat name. popup addItemWithTitle:catName. msg := msg ++ (catName) ++ '\n'. index:= index + 1. ]. "button" button := NSButton alloc initWithFrame:(247<>15 extent:100<>60). window contentView addSubview:button. button setBezelStyle:NSRoundedBezelStyle. button setTitle:'get Contacts'. "label" text := NSTextField alloc initWithFrame:(20<>90 extent:90<>30). text setEditable:YES. text setStringValue:'test'. catSelected := [ text setStringValue: (popup titleOfSelectedItem). ]. window contentView addSubview:popup. window contentView addSubview:text. button setTarget: catSelected. button setAction:#value:. |
|||
|
|
Marketcircle Team |
I think
button setAction:#value:. is the problem. Considering you know all this cocoa stuff, I would go with a plugin, bindings and a nib. |
|||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|

