[guiserver-0.4] button question & bug

Guiserver, GTK-server, OpenGL, PostScript,
HTML 5, MIDI, IDE
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

[guiserver-0.4] button question & bug

Post by newdep »

Hi Lutz,

How do I change the "PRESSED or TOGGLE" color on a button?
Its currently always the color from the look-and-feel default. (it seems)


small remark ->

Toggle-button is unable to handle "" for an empty button text whereas
button does... for toggle-button the text is always "..." when using "".



Bug ->

There is a bug in toggle-button... the code below
shows me sometimed garbage in the text when using "" instead of " ".
That is together with the gs:set-size... odd...


execute this code, and then without the gs:set-font..
On linux i see garbage as text..

sometimes this hapens and sometimes not?? odd to
reproduce...



(gs:init)
(gs:set-look-and-feel "javax.swing.plaf.metal.MetalLookAndFeel")
(gs:frame 'F1 200 200 500 500 "test")
(gs:set-grid-layout 'F1 1 1 1 1 )


(gs:panel 'BP)
(gs:set-background 'BP 0 0 0)

(dotimes (x leds)
(set 'b (sym (append "B" (string x))))
(gs:toggle-button b 'nix "" true)
(gs:set-font b "Sans Serif" "1" )
(gs:set-background b 0 0 0)
(gs:set-foreground b 1 1 1 )
(gs:set-size b 70 70)
(gs:add-to 'BP b))


(gs:add-to 'F1 'BP)
(gs:set-visible 'F1 true)






Norman.
-- (define? (Cornflakes))

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

The Toggle-button Text bug is a string int mixup!

when using font size "1" instead of 1 its going wrong...


also the pressed-state color probably cant be changed when using the JAVA look-and-feels...

For linux you can though change the MOTIF look and feel colors from the Motif config file on Linux....!

For the GTK Metal etc.. it wont work probably... i think...
-- (define? (Cornflakes))

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

how do I change the "PRESSED or TOGGLE" color on a button?
Its currently always the color from the look-and-feel default. (it seems)
Yes, look-and-feel deafults seem always to overwrite the toggle-button color, nothing we can do :-( But you could try to set an icon on a toggle-botton using gs:set-icon and gs:set-pressed-icon. Or you could use image buttons and keep track of a toggle state yourself.
Toggle-button is unable to handle "" for an empty button text whereas
button does... for toggle-button the text is always "..." when using "".
As mentioned yesterday for set-text in gs:frame, empty strings cannot be used (not to be fixed soon) use empty spaces inside the string when doing gs:set-text or specifying text in general. Do not use ever empty strings or text in widgets use " " a space embedded in quotes instead.
For linux you can though change the MOTIF look and feel colors from the Motif config file on Linux....!
There should be a 'properties' file somewhere in your Java installation where you might be able to change these things.

Lutz

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

To allow empty strings "" in the GU server interface the behavior of the newLISP function base64-enc has to be changed. Currently base64-enc returns "" when fed "" it should return "====" instead, which will be decoded as "" by base64-dec. This change will not happen until 9.1.9.

Lutz

Locked