[Pharo-project] StandardWindow Layout Help
I just can't seem to figure this out from the UITheme examples. Can anyone give me some general pointers on building a plain old Window? I know there isn't a UI builder, but how do you control the placement of the child controls you create in the window? For example, the following will create a StandardWindow and add a button to it (in the upper left corner). Do you control placement [of the button] with LayoutFrame? How do you use LayoutFrame? | win btnOk | win := StandardWindow new. btnOk := win newButtonFor: nil action: #ok getEnabled: nil label: 'Ok' help: nil. win addMorph: btnOk . win themeChanged; openInWorld. Thank you. I am finally trying to understand how to build some typical applications without a GUI builder... Take care, Rob
hi rob in the latest 1.1 you can have a look at SettingBrowser has an example. in botsinc book image there is the code of a minibrowser you can also take as example. open | window | Cursor wait showWhile: [window := StandardWindow new model: self. window title: self windowTitle. self buildWindowIn: window. window themeChanged. window openInWorld. ^ window] buildWindowIn: aWindow | statusView toolBar treeMorph toolBarY gap localGap menuBar menuBarY | treeMorph := self treeMorphIn: aWindow. statusView := self statusViewIn: aWindow. toolBar := self toolBarIn: aWindow. menuBar := self menuBarIn: aWindow. menuBar submorphs ifEmpty: [menuBarY := 0] ifNotEmpty: [menuBarY := menuBar minExtent y. aWindow addMorph: menuBar fullFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 0) offsets: (0 @ 0 corner: 0 @ menuBarY))]. localGap := 5. gap := localGap + menuBarY. toolBarY := toolBar minExtent y + gap. aWindow addMorph: toolBar fullFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 0) offsets: (0 @ (gap ) corner: 0 @ (toolBarY + localGap))). aWindow addMorph: treeMorph fullFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 0.99) offsets: (0 @ (toolBarY + localGap + localGap) corner: 0 @ 100 negated)). aWindow addMorph: statusView fullFrame: (LayoutFrame fractions: (0 @ 0.99 corner: 1 @ 1) offsets: (0 @ 100 negated corner: 0 @ 0)). ^ aWindow On Dec 5, 2009, at 10:45 PM, Rob Rothwell wrote:
I just can't seem to figure this out from the UITheme examples.
Can anyone give me some general pointers on building a plain old Window? I know there isn't a UI builder, but how do you control the placement of the child controls you create in the window?
For example, the following will create a StandardWindow and add a button to it (in the upper left corner). Do you control placement [of the button] with LayoutFrame? How do you use LayoutFrame?
| win btnOk |
win := StandardWindow new. btnOk := win newButtonFor: nil action: #ok getEnabled: nil label: 'Ok' help: nil. win addMorph: btnOk . win themeChanged; openInWorld.
Thank you. I am finally trying to understand how to build some typical applications without a GUI builder...
Take care,
Rob _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Hi Rob, Besides the Stéphane's example, you will find attached a cool Morphic example to start experimenting with Layouts. Possibly it's non-functional because of some Nebraska dependencies with the Sound package (I don't know the status of Sound in Pharo) but it would be sufficient for your purposes. To open it: ChatNotes new openAsMorph. and play with the implementation of #openAsMorph Cheers, Hernán 2009/12/5 Rob Rothwell <r.j.rothwell@gmail.com>:
I just can't seem to figure this out from the UITheme examples. Can anyone give me some general pointers on building a plain old Window?  I know there isn't a UI builder, but how do you control the placement of the child controls you create in the window? For example, the following will create a StandardWindow and add a button to it (in the upper left corner).  Do you control placement [of the button] with LayoutFrame?  How do you use LayoutFrame? | win btnOk | win := StandardWindow new. btnOk := win newButtonFor: nil action: #ok getEnabled: nil label: 'Ok' help: nil. win addMorph: btnOk . win themeChanged; openInWorld. Thank you.  I am finally trying to understand how to build some typical applications without a GUI builder... Take care, Rob _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Hi hernan It would be great to have some nice litte examples; if you get some moment could you clean them from nebraska I will have a look later today for the sound in RC we load the package Sound and the extra Morphic examples. Because examples are IMPORTANT Stef On Dec 6, 2009, at 5:58 AM, Hernán Morales Durand wrote:
Hi Rob, Besides the Stéphane's example, you will find attached a cool Morphic example to start experimenting with Layouts. Possibly it's non-functional because of some Nebraska dependencies with the Sound package (I don't know the status of Sound in Pharo) but it would be sufficient for your purposes. To open it:
ChatNotes new openAsMorph.
and play with the implementation of #openAsMorph Cheers,
Hernán
2009/12/5 Rob Rothwell <r.j.rothwell@gmail.com>:
I just can't seem to figure this out from the UITheme examples. Can anyone give me some general pointers on building a plain old Window? I know there isn't a UI builder, but how do you control the placement of the child controls you create in the window? For example, the following will create a StandardWindow and add a button to it (in the upper left corner). Do you control placement [of the button] with LayoutFrame? How do you use LayoutFrame? | win btnOk | win := StandardWindow new. btnOk := win newButtonFor: nil action: #ok getEnabled: nil label: 'Ok' help: nil. win addMorph: btnOk . win themeChanged; openInWorld. Thank you. I am finally trying to understand how to build some typical applications without a GUI builder... Take care, Rob _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
<ChatNotes.st>_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Hi hernan I had a look and this is nice Morph and example. Would be nice to polish it and keep it. http://code.google.com/p/pharo/issues/detail?id=1546 On Dec 6, 2009, at 5:58 AM, Hernán Morales Durand wrote:
Hi Rob, Besides the Stéphane's example, you will find attached a cool Morphic example to start experimenting with Layouts. Possibly it's non-functional because of some Nebraska dependencies with the Sound package (I don't know the status of Sound in Pharo) but it would be sufficient for your purposes. To open it:
ChatNotes new openAsMorph.
and play with the implementation of #openAsMorph Cheers,
Hernán
2009/12/5 Rob Rothwell <r.j.rothwell@gmail.com>:
I just can't seem to figure this out from the UITheme examples. Can anyone give me some general pointers on building a plain old Window? I know there isn't a UI builder, but how do you control the placement of the child controls you create in the window? For example, the following will create a StandardWindow and add a button to it (in the upper left corner). Do you control placement [of the button] with LayoutFrame? How do you use LayoutFrame? | win btnOk | win := StandardWindow new. btnOk := win newButtonFor: nil action: #ok getEnabled: nil label: 'Ok' help: nil. win addMorph: btnOk . win themeChanged; openInWorld. Thank you. I am finally trying to understand how to build some typical applications without a GUI builder... Take care, Rob _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
<ChatNotes.st>_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
participants (3)
-
Hernán Morales Durand -
Rob Rothwell -
Stéphane Ducasse