[vwnc] Creating an inputField programmatically

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

[vwnc] Creating an inputField programmatically

Annick
Hi,

I would like to create an inputFiled programatically, but it does not work, because the controller does not get the focus.

What is wrong ?

          | window composite input1 wrapper |
            window := ApplicationWindow new.
            composite := CompositePart new.
            window component: composite.
            input1 := InputFieldView new.
            window when: #gettingFocus send: #gettingFocus to: input1.
            input1 converter: (PrintConverter for: #string withFormatString: '@@@@@@').
            input1 displaySelection: false.
            input1 setTextStyle: TextAttributes default.
            input1 controller: input1 defaultControllerClass new.
            input1 controller keyboardProcessor: window keyboardProcessor.
            input1 controller maxChars: 10.
            input1 controller
                        keyboardHook:
                                   [:event :controller |
                                   event keyValue = 'a' ifTrue: [self inspect].
                                   event].
            input1 widgetState isEnabled: true.
            input1 widgetState isVisible: true.
            wrapper := BorderedWrapper new.
            wrapper component: input1.
            wrapper
                        setOrigin: 10 @ 10
                        extent: 100 @ 20.
            composite
                        add: wrapper
                        at: 10 @ 10.
            window open


Annick Fron

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Creating an inputField programmatically

Alex Baran
Annick, 

Two points:

Focus management is Controller(not View) responsibility.
KeyboardProcessor should be created.

The code below show inspector if $a pressed:

          | window composite input1 wrapper |
            window := ApplicationWindow new.
            composite := CompositePart new.
            window component: composite.
            input1 := InputFieldView new.

            window when: #gettingFocus send: #focusIn to: input1 controller.

keyboardProcessor := KeyboardProcessor new.
window keyboardProcessor: keyboardProcessor. 
keyboardProcessor addKeyboardReceiver: input1.

            input1 converter: (PrintConverter for: #string withFormatString: '@@@@@@').
            input1 displaySelection: false.
            input1 setTextStyle: TextAttributes default.


            input1 controller maxChars: 10.
            input1 controller
                        keyboardHook:
                                   [:event :controller |
                                   event keyValue = $a ifTrue: [self inspect].
                                   event].
            input1 widgetState isEnabled: true.
            input1 widgetState isVisible: true.
            wrapper := BorderedWrapper new.
            wrapper component: input1.
            wrapper
                        setOrigin: 10 @ 10
                        extent: 100 @ 20.
            composite
                        add: wrapper
                        at: 10 @ 10.
            window open.

--
Alex Baran
    I'm looking for a Smalltalk job



2008/11/10 Annick Fron <[hidden email]>
Hi,

I would like to create an inputFiled programatically, but it does not work, because the controller does not get the focus.

What is wrong ?

          | window composite input1 wrapper |
            window := ApplicationWindow new.
            composite := CompositePart new.
            window component: composite.
            input1 := InputFieldView new.
            window when: #gettingFocus send: #gettingFocus to: input1.
            input1 converter: (PrintConverter for: #string withFormatString: '@@@@@@').
            input1 displaySelection: false.
            input1 setTextStyle: TextAttributes default.
            input1 controller: input1 defaultControllerClass new.
            input1 controller keyboardProcessor: window keyboardProcessor.
            input1 controller maxChars: 10.
            input1 controller
                        keyboardHook:
                                   [:event :controller |
                                   event keyValue = 'a' ifTrue: [self inspect].
                                   event].
            input1 widgetState isEnabled: true.
            input1 widgetState isVisible: true.
            wrapper := BorderedWrapper new.
            wrapper component: input1.
            wrapper
                        setOrigin: 10 @ 10
                        extent: 100 @ 20.
            composite
                        add: wrapper
                        at: 10 @ 10.
            window open


Annick Fron

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Creating an inputField programmatically

Annick
Alex,

What code would you had to link the InputView with a ValueHolder ?
I tried the following:
input1 model:  'blabla' asValue.
input1 when:#changed send: #value to: input1 model withArguments: input1 displayContents text string.

Which does not work.

Le 11 nov. 08 à 19:12, Alex Baran a écrit :

Annick, 

Two points:

Focus management is Controller(not View) responsibility.
KeyboardProcessor should be created.

The code below show inspector if $a pressed:

          | window composite input1 wrapper |
            window := ApplicationWindow new.
            composite := CompositePart new.
            window component: composite.
            input1 := InputFieldView new.

            window when: #gettingFocus send: #focusIn to: input1 controller.

keyboardProcessor := KeyboardProcessor new.
window keyboardProcessor: keyboardProcessor. 
keyboardProcessor addKeyboardReceiver: input1.

            input1 converter: (PrintConverter for: #string withFormatString: '@@@@@@').
            input1 displaySelection: false.
            input1 setTextStyle: TextAttributes default.


            input1 controller maxChars: 10.
            input1 controller
                        keyboardHook:
                                   [:event :controller |
                                   event keyValue = $a ifTrue: [self inspect].
                                   event].
            input1 widgetState isEnabled: true.
            input1 widgetState isVisible: true.
            wrapper := BorderedWrapper new.
            wrapper component: input1.
            wrapper
                        setOrigin: 10 @ 10
                        extent: 100 @ 20.
            composite
                        add: wrapper
                        at: 10 @ 10.
            window open.

--
Alex Baran
    I'm looking for a Smalltalk job



2008/11/10 Annick Fron <[hidden email]>
Hi,

I would like to create an inputFiled programatically, but it does not work, because the controller does not get the focus.

What is wrong ?

          | window composite input1 wrapper |
            window := ApplicationWindow new.
            composite := CompositePart new.
            window component: composite.
            input1 := InputFieldView new.
            window when: #gettingFocus send: #gettingFocus to: input1.
            input1 converter: (PrintConverter for: #string withFormatString: '@@@@@@').
            input1 displaySelection: false.
            input1 setTextStyle: TextAttributes default.
            input1 controller: input1 defaultControllerClass new.
            input1 controller keyboardProcessor: window keyboardProcessor.
            input1 controller maxChars: 10.
            input1 controller
                        keyboardHook:
                                   [:event :controller |
                                   event keyValue = 'a' ifTrue: [self inspect].
                                   event].
            input1 widgetState isEnabled: true.
            input1 widgetState isVisible: true.
            wrapper := BorderedWrapper new.
            wrapper component: input1.
            wrapper
                        setOrigin: 10 @ 10
                        extent: 100 @ 20.
            composite
                        add: wrapper
                        at: 10 @ 10.
            window open


Annick Fron

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Creating an inputField programmatically

Mark Plas

Hi Annick,

 

input1 model: ‘blabla’ asValue

 

is just fine.

 

The when: #changed send: #value … stuff is not necessary.

 

If you press enter in the inputfield, then you’ll notice that the value of the valueholder has changed. The same would happen if you tab out of the field. In your example there is only one field, so tabbing out of it is not possible.

 

Perhaps you want the value in the valueholder to update each time you enter a character in the field? That can be done by doing this:

 

      input1 controller continuousAccept: true.

 

Mark

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Annick Fron
Sent: maandag 17 november 2008 11:59
To: Alex Baran
Cc: vwnc NC
Subject: Re: [vwnc] Creating an inputField programmatically

 

Alex,

 

What code would you had to link the InputView with a ValueHolder ?

I tried the following:

input1 model:  'blabla' asValue.

input1 when:#changed send: #value to: input1 model withArguments: input1 displayContents text string.

 

Which does not work.

 

Le 11 nov. 08 à 19:12, Alex Baran a écrit :



Annick, 

 

Two points:

 

Focus management is Controller(not View) responsibility.

KeyboardProcessor should be created.

 

The code below show inspector if $a pressed:

 

          | window composite input1 wrapper |

            window := ApplicationWindow new.

            composite := CompositePart new.

            window component: composite.

            input1 := InputFieldView new.

 

            window when: #gettingFocus send: #focusIn to: input1 controller.

 

                        keyboardProcessor := KeyboardProcessor new.

                        window keyboardProcessor: keyboardProcessor. 

                        keyboardProcessor addKeyboardReceiver: input1.

 

            input1 converter: (PrintConverter for: #string withFormatString: '@@@@@@').

            input1 displaySelection: false.

            input1 setTextStyle: TextAttributes default.

 

 

            input1 controller maxChars: 10.

            input1 controller

                        keyboardHook:

                                   [:event :controller |

                                   event keyValue = $a ifTrue: [self inspect].

                                   event].

            input1 widgetState isEnabled: true.

            input1 widgetState isVisible: true.

            wrapper := BorderedWrapper new.

            wrapper component: input1.

            wrapper

                        setOrigin: 10 @ 10

                        extent: 100 @ 20.

            composite

                        add: wrapper

                        at: 10 @ 10.

            window open.

 

--

Alex Baran

    I'm looking for a Smalltalk job

 

 

 

2008/11/10 Annick Fron <[hidden email]>

Hi,

 

I would like to create an inputFiled programatically, but it does not work, because the controller does not get the focus.

 

What is wrong ?

 

          | window composite input1 wrapper |

            window := ApplicationWindow new.

            composite := CompositePart new.

            window component: composite.

            input1 := InputFieldView new.

            window when: #gettingFocus send: #gettingFocus to: input1.

            input1 converter: (PrintConverter for: #string withFormatString: '@@@@@@').

            input1 displaySelection: false.

            input1 setTextStyle: TextAttributes default.

            input1 controller: input1 defaultControllerClass new.

            input1 controller keyboardProcessor: window keyboardProcessor.

            input1 controller maxChars: 10.

            input1 controller

                        keyboardHook:

                                   [:event :controller |

                                   event keyValue = 'a' ifTrue: [self inspect].

                                   event].

            input1 widgetState isEnabled: true.

            input1 widgetState isVisible: true.

            wrapper := BorderedWrapper new.

            wrapper component: input1.

            wrapper

                        setOrigin: 10 @ 10

                        extent: 100 @ 20.

            composite

                        add: wrapper

                        at: 10 @ 10.

            window open

 

 

Annick Fron


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc