WebRadioButton usage

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

WebRadioButton usage

Rob Rothwell
Does anyone have an example of using radio buttons in Aida?
 
I can't seem to figure out how to add more than one button by doing something like:
 
 e add: (WebRadioButton new value: #radioTest).
 
adding another button with the same "value" works, but they are not "grouped."  Clicking one does not turn the other one off.
 
Basically, I think I need an example!
 
Rob
 
 

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebRadioButton usage

Janko Mivšek
Rob Rothwell wrote:

> Does anyone have an example of using radio buttons in Aida?
>  
> I can't seem to figure out how to add more than one button by doing
> something like:
>  
>  e add: (WebRadioButton new value: #radioTest).
>  
> adding another button with the same "value" works, but they are not
> "grouped."  Clicking one does not turn the other one off.
>  
> Basically, I think I need an example!

Well, last time I tried using radio buttons, I also didn't get it by
myself ;) So, they obviously need some work on "user friendliness" of
their usage. Any takers?

JAnko

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebRadioButton usage

Rob Rothwell
On Wed, Jun 18, 2008 at 3:27 PM, Janko Mivšek <[hidden email]> wrote:
Well, last time I tried using radio buttons, I also didn't get it by myself ;) So, they obviously need some work on "user friendliness" of their usage. Any takers?

If I can figure it out, I'll let you know!  I'll probably give it somewhat of a try, but it is not "critical" for my application because I can get the same effect with a drop down menu.  They just look different.  Although, it would be useful at times in a table or a grid where I just want the user to be able to select only one row and not multiples, so I'll keep playing!

What I really still can't figure out is why the onChangePost doesn't cause a WebCheckBox to refresh when switching tabs!

By the way, the reception for the Smalltalk Solutions was tonight; it was very exciting and energizing to be around so many people with so much enthusiasm around Smalltalk.

Take care,

Rob

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebRadioButton usage

Rob Rothwell
On Thu, Jun 19, 2008 at 1:41 AM, Rob Rothwell <[hidden email]> wrote:
If I can figure it out, I'll let you know!  I'll probably give it somewhat of a try, but it is not "critical" for my application because I can get the same effect with a drop down menu.  They just look different.  Although, it would be useful at times in a table or a grid where I just want the user to be able to select only one row and not multiples, so I'll keep playing!

I played with this enough to get it "working" so I can understand it.  I'll fix this up and give you a patch...!

Basically, you need to add something like:

WebRadioButton>>acceptFormInputFrom: aPostDataDictionary
    |val|
    val := (aPostDataDictionary at: self name).
    self object perform: (self aspect asString, ':') asSymbol with: val
   
and declare your radio buttons something like:

    e add: (WebRadioButton new value: #radio1; name: 'radioTest'; object: self; aspect: #radio). e addSpace.
    e add: (WebRadioButton new value: #radio2; name: 'radioTest'; object: self; aspect: #radio).

which in the end returns a string 'radio1' or 'radio2'

I just need to clean make some nice convenience accessors like

WebElement>>addRadioButtonAspect: anAspectSymbol value: aSymbol group: aString for: anObject.

and maybe addCheckedRadioButtonAspect...etc...

and investigate how to preset the object value when the page is first drawn.

Rob

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebRadioButton usage

Rob Rothwell
On Thu, Jun 19, 2008 at 2:46 AM, Rob Rothwell <[hidden email]> wrote:
and investigate how to preset the object value when the page is first drawn.

ahhh...just learned a bit about Aida:

modify

WebRadioButton>>printHTMLPageOn: aStream forSession: aSession
    self prepareToHTMLPrintOn: aSession.
    aStream nextPutAll: self ident, '<input'.
    self printAttributesOn: aStream for: aSession.
    self isSelected ifTrue: [aStream nextPutAll: ' checked'].
    aStream nextPutAll: '>'.

and implement

WebRadioButton>>isSelected
    |val|
    val:=self object perform: (self aspect asString) asSymbol.
    ^(val asSymbol = self value)

and everything works fine.

So, the community question is:

Do you want a WebRadioButton to return a string value corresponding to the choice you made, much like a drop-down menu, or an index, or both, or...?

Anyway, it's a start...just need to have it make sense with a WebGrid, and you could force a choice of just one item...

Rob


_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebRadioButton usage

Rob Rothwell
One LAST thing...!

If you wanted a WebRadioGroup WebComponent (or something like that), what would be the best way to "draw a frame" around the group and label it?  I haven't done anything like that yet...

Rob

On Thu, Jun 19, 2008 at 3:11 AM, Rob Rothwell <[hidden email]> wrote:
On Thu, Jun 19, 2008 at 2:46 AM, Rob Rothwell <[hidden email]> wrote:
and investigate how to preset the object value when the page is first drawn.

ahhh...just learned a bit about Aida:

modify

WebRadioButton>>printHTMLPageOn: aStream forSession: aSession
    self prepareToHTMLPrintOn: aSession.
    aStream nextPutAll: self ident, '<input'.
    self printAttributesOn: aStream for: aSession.
    self isSelected ifTrue: [aStream nextPutAll: ' checked'].
    aStream nextPutAll: '>'.

and implement

WebRadioButton>>isSelected
    |val|
    val:=self object perform: (self aspect asString) asSymbol.
    ^(val asSymbol = self value)

and everything works fine.

So, the community question is:

Do you want a WebRadioButton to return a string value corresponding to the choice you made, much like a drop-down menu, or an index, or both, or...?

Anyway, it's a start...just need to have it make sense with a WebGrid, and you could force a choice of just one item...

Rob



_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebRadioButton usage

Giuseppe
A DIV controlled over CSS with borders?

Rob Rothwell escribió:

> One LAST thing...!
>
> If you wanted a WebRadioGroup WebComponent (or something like that),
> what would be the best way to "draw a frame" around the group and
> label it?  I haven't done anything like that yet...
>
> Rob
>
> On Thu, Jun 19, 2008 at 3:11 AM, Rob Rothwell <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     On Thu, Jun 19, 2008 at 2:46 AM, Rob Rothwell
>     <[hidden email] <mailto:[hidden email]>> wrote:
>
>         and investigate how to preset the object value when the page
>         is first drawn.
>
>
>     ahhh...just learned a bit about Aida:
>
>     modify
>
>     WebRadioButton>>printHTMLPageOn: aStream forSession: aSession
>         self prepareToHTMLPrintOn: aSession.
>         aStream nextPutAll: self ident, '<input'.
>         self printAttributesOn: aStream for: aSession.
>         self isSelected ifTrue: [aStream nextPutAll: ' checked'].
>         aStream nextPutAll: '>'.
>
>     and implement
>
>     WebRadioButton>>isSelected
>         |val|
>         val:=self object perform: (self aspect asString) asSymbol.
>         ^(val asSymbol = self value)
>
>     and everything works fine.
>
>     So, the community question is:
>
>     Do you want a WebRadioButton to return a string value
>     corresponding to the choice you made, much like a drop-down menu,
>     or an index, or both, or...?
>
>     Anyway, it's a start...just need to have it make sense with a
>     WebGrid, and you could force a choice of just one item...
>
>     Rob
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>  

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebRadioButton usage

Giuseppe
In reply to this post by Rob Rothwell
In other languages, the normal way is to ask to the control, if it's
selected or not, returning True or False.

A RadioButton, normally, don't answer nothing, only true or false.

If you group this radiobuttons, on a GroupRadioButton, then, for
example, you could do something like:
GroupRadioButton>>wichSelected

returning the RadioButton selected for example.

Only my 2 cents.

Rob Rothwell escribió:

> On Thu, Jun 19, 2008 at 2:46 AM, Rob Rothwell <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     and investigate how to preset the object value when the page is
>     first drawn.
>
>
> ahhh...just learned a bit about Aida:
>
> modify
>
> WebRadioButton>>printHTMLPageOn: aStream forSession: aSession
>     self prepareToHTMLPrintOn: aSession.
>     aStream nextPutAll: self ident, '<input'.
>     self printAttributesOn: aStream for: aSession.
>     self isSelected ifTrue: [aStream nextPutAll: ' checked'].
>     aStream nextPutAll: '>'.
>
> and implement
>
> WebRadioButton>>isSelected
>     |val|
>     val:=self object perform: (self aspect asString) asSymbol.
>     ^(val asSymbol = self value)
>
> and everything works fine.
>
> So, the community question is:
>
> Do you want a WebRadioButton to return a string value corresponding to
> the choice you made, much like a drop-down menu, or an index, or both,
> or...?
>
> Anyway, it's a start...just need to have it make sense with a WebGrid,
> and you could force a choice of just one item...
>
> Rob
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>  

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebRadioButton usage

Janko Mivšek
Giuseppe Luigi Punzi wrote:

> If you group this radiobuttons, on a GroupRadioButton, then, for
> example, you could do something like:
> GroupRadioButton>>wichSelected

I think this is the way to proceed. And if you think a bit, a group of
radio buttons is very similar by function to WebMemu (a drop-down menu).
Here also you have one selection among all provided.

So we can simply copy the protocol from WebMenu to WebRadioButtonGroup.
Then we just need to get individual RadioButtons from this group and
place them on the webpage. Or simply put a whole group there? But radio
buttons can be placed horizontally, vertically, even with some arbitrary
placement ....

Janko



>
> Rob Rothwell escribió:
>> On Thu, Jun 19, 2008 at 2:46 AM, Rob Rothwell <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>>     and investigate how to preset the object value when the page is
>>     first drawn.
>>
>>
>> ahhh...just learned a bit about Aida:
>>
>> modify
>>
>> WebRadioButton>>printHTMLPageOn: aStream forSession: aSession
>>     self prepareToHTMLPrintOn: aSession.
>>     aStream nextPutAll: self ident, '<input'.
>>     self printAttributesOn: aStream for: aSession.
>>     self isSelected ifTrue: [aStream nextPutAll: ' checked'].
>>     aStream nextPutAll: '>'.
>>
>> and implement
>>
>> WebRadioButton>>isSelected
>>     |val|
>>     val:=self object perform: (self aspect asString) asSymbol.
>>     ^(val asSymbol = self value)
>>
>> and everything works fine.
>>
>> So, the community question is:
>>
>> Do you want a WebRadioButton to return a string value corresponding to
>> the choice you made, much like a drop-down menu, or an index, or both,
>> or...?
>>
>> Anyway, it's a start...just need to have it make sense with a WebGrid,
>> and you could force a choice of just one item...
>>
>> Rob
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Aida mailing list
>> [hidden email]
>> http://lists.aidaweb.si/mailman/listinfo/aida
>>  
>
>

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebRadioButton usage

Giuseppe
Hi


> So we can simply copy the protocol from WebMenu to WebRadioButtonGroup.
> Then we just need to get individual RadioButtons from this group and
> place them on the webpage. Or simply put a whole group there? But radio
> buttons can be placed horizontally, vertically, even with some arbitrary
> placement ....
>
>  

Well. GroupRadioButton, can hold a collection of RadioButtons, and the
behaviour how RadioButtons are displayed. Horizontal, Vertical, "table"
3 columns, etc..

Cheers.

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida