OK then,
Let me start with something we used to do alot (but I failed to figure
out how to do it)
How exacly we call a messagedialog from another Window
for example I have a window with a button
when I clicked the button,
it display a messagedialog as a modal form
and when I press the ok button at the messagedialog, it close
my code goes this far then I got lost ![:slight_smile: :slight_smile:](/images/emoji/twitter/slight_smile.png?v=6)
require ‘libglade2’
class Win1
include GetText
attr :glade
PROG_PATH = “win1.glade”
PROG_NAME = “YOUR_APPLICATION_NAME”
def initialize
call(PROG_PATH, nil, PROG_NAME)
end
def call(path_or_data, root = nil, domain = nil, localedir = nil,
flag = GladeXML::FILE)
bindtextdomain(domain, localedir, nil, “UTF-8”)
@glade = GladeXML.new(path_or_data, root, domain, localedir, flag)
{|handler| method(handler)}
@messagedialog1 = @glade.get_widget(“messagedialog1”)
#GtkMessageDialog
@dialog_vbox1 = @glade.get_widget(“dialog_vbox1”) #GtkVBox
@dialog_action_area1 = @glade.get_widget(“dialog_action_area1”)
#GtkHButtonBox
@window1 = @glade.get_widget(“window1”) #GtkWindow
@button1 = @glade.get_widget(“button1”) #GtkButton
end
def on_button1_clicked() #button1(on_button1_clicked)
#What should I type here???
end
def showMessagedialog1 #procedure to show
messagedialog1(GtkMessageDialog)
#and here???
end
def showWindow1 #procedure to show window1(GtkWindow)
@window1.show
Gtk.main
end
end
a = Win1.new
a.showWindow1
the glade file looks like this :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
5
False
GTK_WIN_POS_CENTER_ON_PARENT
GDK_WINDOW_TYPE_HINT_DIALOG
True
False
GTK_MESSAGE_ERROR
GTK_BUTTONS_OK
True
2
True
GTK_BUTTONBOX_END
False
GTK_PACK_END
True
True
True
button
0