R
Ronny
I would like to have a modal dialogue window appear, when I press a
button. This window
should contain (in its first version) just an entry field and an OK
button, and when OK
is pressed, the value of the entry field should be returned.
I have found out that I have to use the "grab" method to make a window
modal, so here
is the function which is supposed to handle the complete modal
dialogue:
def get_new_dir
dialogue=TkToplevel.new() {title "change directory"}
dialogue.grab("set") # make modal
frame=TkFrame.new(dialogue).pack('fill'=>'both')
entry=TkEntry.new(frame).pack()
entry.value='../'
button=TkButton.new(frame,
:text => "Yeah",
:command => dialogue.grab("release")
)
button.pack()
entry.value # return value of entry field
end
This works *nearly* well, except that I get an incomprehensibel error
message
(incomprehensible to me at least), which you can see in the screenshot
at
http://img135.imageshack.us/img135/4464/rubytkerror7we.jpg
It claims "wrong number of arguments", but I can not recognize from the
message which function is called with the wrong number of arguments.
Anyone out there who can spot the error?
Ronald
button. This window
should contain (in its first version) just an entry field and an OK
button, and when OK
is pressed, the value of the entry field should be returned.
I have found out that I have to use the "grab" method to make a window
modal, so here
is the function which is supposed to handle the complete modal
dialogue:
def get_new_dir
dialogue=TkToplevel.new() {title "change directory"}
dialogue.grab("set") # make modal
frame=TkFrame.new(dialogue).pack('fill'=>'both')
entry=TkEntry.new(frame).pack()
entry.value='../'
button=TkButton.new(frame,
:text => "Yeah",
:command => dialogue.grab("release")
)
button.pack()
entry.value # return value of entry field
end
This works *nearly* well, except that I get an incomprehensibel error
message
(incomprehensible to me at least), which you can see in the screenshot
at
http://img135.imageshack.us/img135/4464/rubytkerror7we.jpg
It claims "wrong number of arguments", but I can not recognize from the
message which function is called with the wrong number of arguments.
Anyone out there who can spot the error?
Ronald