Closed gummybears closed 4 years ago
Tried the following
name: test
version: 1.0.0
dependencies:
gobject:
github: jhass/crystal-gobject
version: ~> 0.8.0
Changed line 18 in lib/gobject/src/gtk/gtk.cr
require "signal"
require "../gobject"
require_gobject "Gtk", "3.0"
require "../g_object"
require "../gdk"
module Gtk
class Window
def self.new : self
new type: Gtk::WindowType::TOPLEVEL
end
end
class Builder
def connect_signals
connect_signals # nil <------- commented
end
def [](id)
object(id).not_nil!
end
def []?(id)
object(id)
end
end
class CssProvider
def load_from_data(string : String)
load_from_data(string.to_slice)
end
end
class Application
def run
run Array.new(ARGC_UNSAFE) { |i| String.new(ARGV_UNSAFE[i]) }
end
end
end
and commented line 7 in my source program
builder = Gtk::Builder.new_from_file("#{__DIR__}/main.glade")
# builder.connect_signals <----- commented
and removed the line
eventbox.events = Gdk::EventMask::EXPOSURE_MASK | Gdk::EventMask::LEAVE_NOTIFY_MASK | Gdk::EventMask::BUTTON_PRESS_MASK | Gdk::EventMask::POINTER_MOTION_MASK | Gdk::EventMask::POINTER_MOTION_HINT_MASK
I was able to build and run my test program, the file chooser dialog works, loading of a png image also works, and also got the correct (x,y) coordinates of the mouse.
Working on a small program which loads an image into a Gtk::Image. I am trying to get the mouse (x,y) position when I click on the image and moves the mouse. Using a Gtk::EventBox around the Gtk::Image.
Things seem to work, loading and displaying the image, capturing the mouse down and mouse move events except I am not getting the correct x,y values. Either these values are not set or most likely I am doing something wrong.
Here is the code