0

I'm trying to set the locale format of a spin button. The decimal mark on my system is a comma , and I would like it to become a dot ..

Is there a function in GTK or Glib to set the locale formatting globally or locally on a widget.

I looked in hackage functions named local, format, decimal, ... in GTK and Glib but I didn't find the appropriate function.

I have read it is possible to set the output manually with the function entrySetText but I'm looking for a global setting.

Do you know how to change locale format globally in a Gtk program? The correct function?

Cactus
  • 27,075
  • 9
  • 69
  • 149
JeanJouX
  • 2,555
  • 1
  • 25
  • 37

1 Answers1

0

I find a way to have the correct format in the spinbutton entry by setting the text with the entrySetText function :

onValueSpinned spin $  do
    val <- spinButtonGetValue spin
    entrySetText spin $ printf "%6.2f" val
    return ()

The entry text is modified each time the value of the spinbutton is changed. The decimal mark used by printf is a dot . and is correct now.

The following code snippet work too :

onOutput spin $  do
    val <- spinButtonGetValue spin
    entrySetText spin $ printf "%6.2f" val
    return True
JeanJouX
  • 2,555
  • 1
  • 25
  • 37