Help using Merlin

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

Help using Merlin

hernanmd
Hi all, I'm using Merlin and need some help, for example in the following script I want to associate the next button with the 'Option 2' to the ListPart (in a second pane) and the next button with the 'Option 1' to the radio button pane group (options 3 and 4, in another second pane). Should I use branches? and callbacks? May anyone show an example how to do it?

| wizard  |
   
wizard := WizardControl new.
wizard renderer: MerlinMorphicWizardRenderer new.
wizard
    addPane: ( WizardFirstPane new
                row: ( RadioButtonsPart  new
                        inGroupboxNamed: 'Choose Option A';
                        options: { #'Option 1'. #'Option 2' };
                        defaultValue: nil;           
                        yourself )
                associatedTo: #optionSelected );
    addPane: ( WizardMiddlePane new
                    row: ( ListPart new
                            initialList: { 1 . 2 . 3 . 4 };
                            yourself ) );
    addPane: ( WizardFirstPane new
                row: ( RadioButtonsPart  new
                        inGroupboxNamed: 'Choose Option B';
                        options: { #'Option 3'. #'Option 4' };
                        defaultValue: nil;           
                        yourself )
                associatedTo: #optionSelected ).
wizard open.

Cheers,

Hernán


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help using Merlin

cdelaunay
hello,
I'm not sure to see exactly what you are looking for, but it could look like something like that:

| wizard  tmpPane1 tmpPane2 tmpPane3 |
    
wizard := WizardControl new.
wizard renderer: MerlinMorphicWizardRenderer new.
tmpPane1 := ( WizardFirstPane new
                row: ( RadioButtonsPart  new
                        inGroupboxNamed: 'Choose Option A';
                        options: { #'Option 1'. #'Option 2' };
                        defaultValue: nil;    
callback: [:value :tmpPart |
(value = #'Option 2') ifTrue: [
wizard selectBranch: 2.
]
ifFalse: [
wizard selectBranch: 1.
]
];        
                        yourself )
associatedTo: #optionA
).

    tmpPane2 :=( WizardLastPane new
                    row: ( ListPart new
                            initialList: { 1 . 2 . 3 . 4 };
                            yourself )
associatedTo: #optionB
 ).

   tmpPane3 := ( WizardLastPane new
                row: ( RadioButtonsPart  new
                        inGroupboxNamed: 'Choose Option B';
                        options: { #'Option 3'. #'Option 4' };
                        defaultValue: nil;            
                        yourself )
associatedTo: #optionB
).

wizard addPane: tmpPane1.
wizard addPane: tmpPane2 .
wizard addBranch.
wizard selectBranch: 2.
wizard addPane: tmpPane1.
wizard addPane: tmpPane3 .
wizard selectBranch: 1.
wizard open. 


You can also look at the class MerlinExamples, there is several examples in the class side.


2012/4/10 Hernán Morales Durand <[hidden email]>
Hi all, I'm using Merlin and need some help, for example in the following script I want to associate the next button with the 'Option 2' to the ListPart (in a second pane) and the next button with the 'Option 1' to the radio button pane group (options 3 and 4, in another second pane). Should I use branches? and callbacks? May anyone show an example how to do it?

| wizard  |
   
wizard := WizardControl new.
wizard renderer: MerlinMorphicWizardRenderer new.
wizard
    addPane: ( WizardFirstPane new
                row: ( RadioButtonsPart  new
                        inGroupboxNamed: 'Choose Option A';
                        options: { #'Option 1'. #'Option 2' };
                        defaultValue: nil;           
                        yourself )
                associatedTo: #optionSelected );
    addPane: ( WizardMiddlePane new
                    row: ( ListPart new
                            initialList: { 1 . 2 . 3 . 4 };
                            yourself ) );
    addPane: ( WizardFirstPane new
                row: ( RadioButtonsPart  new
                        inGroupboxNamed: 'Choose Option B';
                        options: { #'Option 3'. #'Option 4' };
                        defaultValue: nil;           
                        yourself )
                associatedTo: #optionSelected ).
wizard open.

Cheers,

Hernán


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




--
Cyrille Delaunay

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help using Merlin

hernanmd
Thank you Cyrille, that's exactly what I want. You may want to be noticed of a couple of issues

-When opened, the RadioButtonsPart has the first radio button option selected (which is set in SingleButtonAtLeastOneSelectionPart>>options: ) and I've found no way of opening the radio buttons all unselected, this is to force the user to select one option before hitting Next button. I've modified the following method but I suspect there is a better way:

>>initializeRadioButtons

    radioButtons :=
            self wizardPart options collect: [:aSymbol |
                |radioButton|
                radioButton := (self newRadionButtonFor: (self wizardPart modelOfOption: aSymbol) getSelected: #contents setSelected: #contents:  label: aSymbol).
                radioButton buttonMorph selected: false.
                radioButton
            ].
    ^ radioButtons


-Another thing is that it seems there is no way to set up the initial extension of the container.
-Finally in this method the parameter anOption is not used

unselectOption: anOption

    self selectedOption: nil.
    self hasChanged.


Hernán       


2012/4/11 Cyrille Delaunay <[hidden email]>
hello,
I'm not sure to see exactly what you are looking for, but it could look like something like that:

| wizard  tmpPane1 tmpPane2 tmpPane3 |
    
wizard := WizardControl new.
wizard renderer: MerlinMorphicWizardRenderer new.
tmpPane1 := ( WizardFirstPane new
                row: ( RadioButtonsPart  new
                        inGroupboxNamed: 'Choose Option A';
                        options: { #'Option 1'. #'Option 2' };
                        defaultValue: nil;    
callback: [:value :tmpPart |
(value = #'Option 2') ifTrue: [
wizard selectBranch: 2.
]
ifFalse: [
wizard selectBranch: 1.
]
];        
                        yourself )
associatedTo: #optionA
).

    tmpPane2 :=( WizardLastPane new
                    row: ( ListPart new
                            initialList: { 1 . 2 . 3 . 4 };
                            yourself )
associatedTo: #optionB
 ).

   tmpPane3 := ( WizardLastPane new
                row: ( RadioButtonsPart  new
                        inGroupboxNamed: 'Choose Option B';
                        options: { #'Option 3'. #'Option 4' };
                        defaultValue: nil;            
                        yourself )
associatedTo: #optionB
).

wizard addPane: tmpPane1.
wizard addPane: tmpPane2 .
wizard addBranch.
wizard selectBranch: 2.
wizard addPane: tmpPane1.
wizard addPane: tmpPane3 .
wizard selectBranch: 1.
wizard open. 


You can also look at the class MerlinExamples, there is several examples in the class side.


2012/4/10 Hernán Morales Durand <[hidden email]>
Hi all, I'm using Merlin and need some help, for example in the following script I want to associate the next button with the 'Option 2' to the ListPart (in a second pane) and the next button with the 'Option 1' to the radio button pane group (options 3 and 4, in another second pane). Should I use branches? and callbacks? May anyone show an example how to do it?

| wizard  |
   
wizard := WizardControl new.
wizard renderer: MerlinMorphicWizardRenderer new.
wizard
    addPane: ( WizardFirstPane new
                row: ( RadioButtonsPart  new
                        inGroupboxNamed: 'Choose Option A';
                        options: { #'Option 1'. #'Option 2' };
                        defaultValue: nil;           
                        yourself )
                associatedTo: #optionSelected );
    addPane: ( WizardMiddlePane new
                    row: ( ListPart new
                            initialList: { 1 . 2 . 3 . 4 };
                            yourself ) );
    addPane: ( WizardFirstPane new
                row: ( RadioButtonsPart  new
                        inGroupboxNamed: 'Choose Option B';
                        options: { #'Option 3'. #'Option 4' };
                        defaultValue: nil;           
                        yourself )
                associatedTo: #optionSelected ).
wizard open.

Cheers,

Hernán


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




--
Cyrille Delaunay

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev