Dialog creation without ViewComposer

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Dialog creation without ViewComposer

bachinger software-2
Hallo Dolphin-Friends,

I need Dialogs created by methods like the FramingLayout class method
example1.
After looking at the Dolphin code I renamed above Method to example2
and changed only the first and the last line of code and evaluated it.

I got a wonderful Dialog but having a hour glass as mouse cursor, and no
regular way to edit or close the dialog. What I'm doing wrong, or what I
can do better to get input control over the dialog.

I get rid of it be using
DialogView allInstances do: [:dv| dv close].

Thanks in forward
Christoph J. Bachinger
CJB


The code below should work in any workspace


example2
        "A simple example of building a view with a framing layout."
"
        FramingLayout example1
"

        | shell layout label button text1 text2  combo1|
        (shell := View desktop addSubView: DialogView new) "Changed
<ShellView> to <DialogView>"
                caption: 'FramingLayout example 1';
                backcolor: (Color face3d);
                layoutManager: (layout := FramingLayout new);
                extent: 300@200.

        "Create some sample controls"
        (label := shell addSubView: StaticText new) value: 'Label'.
        (button := shell addSubView: PushButton new) text: 'Go'; command:
#yourself.
        (text1 := shell addSubView: TextEdit new) value: 'Text 1'.
        (text2 := shell addSubView: TextEdit new) value: 'Text 2'.
        (combo1 := shell addSubView: ComboBox new)
                list: (Array with: '123' with: '345');
                selectionByIndex: 2.

        "Just leave the label where it is"
        label rectangle: (10@10 extent: 100@20).

        "Wish to button to stay at same extent but hug the topright"
        button arrangement leftFraming: #fixedParentRight; rightFraming:
#fixedParentRight.
        layout resize: button to: (210@10 corner: 290@30).

        "Wish left text to consume half the width and all the bottom space"
        text1 arrangement rightFraming: #relativeParentWidth; bottomFraming:
#fixedParentBottom.
        layout resize: text1 to: (10@40 corner: 130@190).

        "Wish bottom right text to float in the same relative postion, but same
height and width"
        text2 arrangement leftFraming: #relativeParentWidth; rightFraming:
#fixedViewLeft; topFraming: #relativeParentHeight; bottomFraming:
#fixedViewTop.
        layout resize: text2 to: (140@40 corner: 290@80).

        "Changed <view show.> to: <shell view showModalTo: View desktop.>"

  shell view showModalTo: View desktop.


Reply | Threaded
Open this post in threaded view
|

Re: Dialog creation without ViewComposer

Ian Bartholomew-17
Christoph,

> I need Dialogs created by methods like the FramingLayout class method
> example1.

That example is a bit more complex than you need. To see a default dialog
you can evaluate -

dialog := Dialog create.
dialog showModal

To "fiddle about" with the contents just add a bit more code between the
above lines -

dialog := Dialog create.
view := dialog view.
view layoutManager: FramingLayout new.
view addSubView: (text := TextEdit new).
text arrangement
    leftFraming: #fixedParentLeft;
    leftOffset: 8;
    rightFraming: #fixedParentRight;
    rightOffset: -8;
    topFraming: #fixedParentTop;
    topOffset: 8;
    bottomFraming: #fixedViewTop;
    bottomOffset: 24.
dialog showModal

You will obviously need a new Dialog subclass to look after the Presenter
(and Model) side of things.

Regards
    Ian


Reply | Threaded
Open this post in threaded view
|

Re: Dialog creation without ViewComposer

bachinger software-2
Ian Bartholomew schrieb:

>
> Christoph,
>
> > I need Dialogs created by methods like the FramingLayout class method
> > example1.
>
> That example is a bit more complex than you need. To see a default dialog
> you can evaluate -
>
> dialog := Dialog create.
> dialog showModal
>
> To "fiddle about" with the contents just add a bit more code between the
> above lines -
>
> dialog := Dialog create.
> view := dialog view.
> view layoutManager: FramingLayout new.
> view addSubView: (text := TextEdit new).
> text arrangement
>     leftFraming: #fixedParentLeft;
>     leftOffset: 8;
>     rightFraming: #fixedParentRight;
>     rightOffset: -8;
>     topFraming: #fixedParentTop;
>     topOffset: 8;
>     bottomFraming: #fixedViewTop;
>     bottomOffset: 24.
> dialog showModal
>
> You will obviously need a new Dialog subclass to look after the Presenter
> (and Model) side of things.
>
> Regards
>     Ian

Thanks Ian you showed me the way, I tried to do it more puristic
without needing any Default View.

        dialog := Dialog new.
        dialog view: (View desktop addSubView: DialogView new).
        dialog connectView.
        (dialog view)
                extent: 300 @ 300;
                layoutManager: FramingLayout new;
                addSubView: (text := TextEdit new).
        (text arrangement)
                leftFraming: #fixedParentLeft;
                leftOffset: 8;
                rightFraming: #fixedParentRight;
                rightOffset: -8;
                topFraming: #fixedParentTop;
                topOffset: 8;
                bottomFraming: #fixedViewTop;
                bottomOffset: 24.
        dialog showModal

Again thanks a lot
CJB
bachinger software