Can't set id attribute

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

Can't set id attribute

HilaireFernandes
Dear all,

In the following circumstance the id is not set as an attribute of the
inputField (last line):

renderWidgetId: id on: html
    | tag inputField |
    tag := (html span)
        with: [
            inputField := (html textInput)
                value: input;
                size: 10;
                callback: [ :val | self input: val ].
            [...]
        ];
        yourself.  
    inputField id: id.


Only when the id is set immediately, the id is correctly set:

renderWidgetId: id on: html
    | tag inputField |
    tag := (html span)
        with: [
            inputField := (html textInput)
                value: input;
                size: 10;
                id: id;
                callback: [ :val | self input: val ].
            [...]
     ];
      yourself.  


I need to set the id afterwards to factor out some code. There are
probably other way I can do it, but I am really curious to know why the
former code does not work.

Thanks!

Hilaire

--
Dr. Geo - http://drgeo.eu
iStoa - http://istoa.drgeo.eu


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Can't set id attribute

Bob Arning-2
That's because when you reach the end of the with: block for the span, it flushes the canvas which closes the currentBrush (the textInput) if needed.

IOW, by the time you try to set the id, all the html for the textInput has already been written. Try putting a
    self halt

before
    inputField id: id
and then explore html to see that this is the case

On 4/11/15 8:49 AM, Hilaire wrote:
Dear all,

In the following circumstance the id is not set as an attribute of the
inputField (last line):

renderWidgetId: id on: html
    | tag inputField |
    tag := (html span)
        with: [
            inputField := (html textInput)
                value: input;
                size: 10;
                callback: [ :val | self input: val ].
            [...]
        ];
        yourself.   
    inputField id: id.


Only when the id is set immediately, the id is correctly set:

renderWidgetId: id on: html
    | tag inputField |
    tag := (html span)
        with: [
            inputField := (html textInput)
                value: input;
                size: 10;
                id: id;
                callback: [ :val | self input: val ].
            [...]
     ];
      yourself.   


I need to set the id afterwards to factor out some code. There are
probably other way I can do it, but I am really curious to know why the
former code does not work.

Thanks!

Hilaire



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside