radio-button/check box bug

Started by HPW, June 17, 2007, 12:15:42 AM

Previous topic - Next topic

HPW

Without text the selected flag would not work.



Instead of:

(define (radio-button id action text selected)
(if text
(net-send out (string "radio-button " id " " action " " (base64-enc text) " " selected "n"))
(net-send out (string "radio-button " id " " action "n")))
)

(define (check-box id action text selected)
(if text
(net-send out (string "check-box " id " " action " " (base64-enc text) " " selected "n"))
(net-send out (string "check-box " id " " action "n")))
)

it should read:

(define (radio-button id action text selected)
(if text
(net-send out (string "radio-button " id " " action " " (base64-enc text) " " selected "n"))
(net-send out (string "radio-button " id " " action " nil " selected "n")))
)

(define (check-box id action text selected)
(if text
(net-send out (string "check-box " id " " action " " (base64-enc text) " " selected "n"))
(net-send out (string "check-box " id " " action " nil " selected "n")))
)
Hans-Peter

Lutz

#1
QuoteWithout text the selected flag would not work.


This is how the syntax pattern specifies it. All functions with more than one optional parameter work this way. It makes for easier understanding of source code when you don't know the internal workings of the API functions.



Lutz

HPW

#2
I do not get it.

Without a text I can not preset the status?
Hans-Peter

Lutz

#3
You could either do:


(gs:radio-button 'mybutton 'handler " " true)

; or do

(gs:radio-button 'mybutton 'handler)
(gs:set-selected 'mybutton true)


In most cases users will specify some text for the radio button. So the second case will hardly ever occur.



Lutz