Guiserver, GTK-server, OpenGL, PostScript,
HTML 5, MIDI, IDE
HPW
Posts: 1390 Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:
Post
by HPW » Sun Jun 17, 2007 7:15 am
Without text the selected flag would not work.
Instead of:
Code: Select all
(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:
Code: Select all
(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
Posts: 5289 Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:
Post
by Lutz » Sun Jun 17, 2007 4:36 pm
Without 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
Posts: 1390 Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:
Post
by HPW » Sun Jun 17, 2007 4:40 pm
I do not get it.
Without a text I can not preset the status?
Hans-Peter
Lutz
Posts: 5289 Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:
Post
by Lutz » Sun Jun 17, 2007 4:55 pm
You could either do:
Code: Select all
(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