ETk problem

uzturnau <>
Fri Jan 21 01:57:27 CET 2000


I noticed that the function tk:cmd(Entry, [get]) sometimes returns a
string, and sometimes a number, depending on whether the entry field
contains only [-0-9.] or other characters as well. I don't think this
behaviour is very useful, but I could live with it if only I knew an
Erlang function to test for being a number or for being a string. Is
there such a function? Or, better still, is there a way to force
tk:cmd(Entry, [get]) to always return a string? I want to be able to
clear an entry, and the following function gives an error if the user
has entered "123" (though it works fine if he has entered "xyz"):

clear(Entry) ->
  Text = tk:cmd(Entry, [get]),
  tk:cmd(Entry, [delete, 0, string:len(Text)]).

Thanks for any help,

Pawel Turnau



More information about the erlang-questions mailing list