Re: How to create objects and how to get/set their attributes
Glynn Clements <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.gui |
|---|---|
| Message-ID | <[email protected]> |
David Sankel wrote: > The second is a motif style (please correct me if I > have this wrong): > > button <- create "Button" parentWindow [ title =: > "Hello", position =: (0,0), size =: (300,50) ] > set button [ onPress =: (buttonPressed button) ] Xt (Athena/Motif) style is more like: formW :: FormWidget acceptB, cancelB :: ButtonWidget formW <- create "yesNoForm" shellW [] acceptB <- create "accept" formW [] addCallback acceptB onAction acceptFunc addCallback acceptB onAction closeFunc cancelB <- create "cancel" formW [] addCallback cancelB onAction cancelFunc addCallback cancelB onAction closeFunc I suppose that you could make the callback list a property, e.g.: acceptB <- create "accept" formW [onAction =: [acceptFunc, closeFunc]] cancelB <- create "cancel" formW [onAction =: [cancelFunc, closeFunc]] but it's more usual to add/remove callbacks independently than to set the entire callback list in one go. Everything else can (and probably should) go into the resource files. -- Glynn Clements <[email protected]>