Hi! Your plugin is really great! Thanks. One more little question. Is it possible to add event listeners to the maps via your plugin? greetings /till -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ym4r-user/attachments/20061106/6b1c6f4f/attachment.html
Hello, Thank you! Events are possible. Either through the @map.record_init "azeazeae" (for arbitrary events like domlistener) or through the @map.event_init(@map,:click,"function(){alert(''HOYOYO'');}"). The latter will give you: GEvent.addListener(map,"click", function(){alert(''HOYOYO'');}) inserted during initialization. guilhem On 11/6/06, Till <tschellhorn at gmail.com> wrote:> > Hi! > > Your plugin is really great! Thanks. > > One more little question. > Is it possible to add event listeners to the maps via your plugin? > > greetings > /till > > _______________________________________________ > Ym4r-user mailing list > Ym4r-user at rubyforge.org > http://rubyforge.org/mailman/listinfo/ym4r-user > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ym4r-user/attachments/20061107/838358b5/attachment-0001.html
I don''t get it! Is it right like this? I think I''m messing around with the @maps and @markers !? /till class MapController < ApplicationController def index @map = GMap.new("map_div") @map.control_init(:large_map => true) @map.center_zoom_init([59.91106, 10.72223],13) @map.overlay_init(GMarker.new([59.91122, 10.72217], :title => "Hello", :info_window => "Blabla!", :draggable => "true")) end def shift @map= Variable.new("map") @marker = GMarker.new([59.92222, 10.73333], :title => "Update", :draggable => "true") @marker.event_init(@marker, :click, "function(){ marker.openInfoWindowHtml(''hei'');}") end end shift.rjs: page << @map.add_overlay(@marker) On 11/7/06, Guilhem Vellut <guilhem.vellut at gmail.com> wrote:> > Hello, > Thank you! > Events are possible. Either through the @map.record_init "azeazeae" (for > arbitrary events like domlistener) or through the @map.event_init(@map,:click,"function(){alert(''HOYOYO'');}"). > The latter will give you: GEvent.addListener(map,"click", > function(){alert(''HOYOYO'');}) inserted during initialization. > > guilhem > > On 11/6/06, Till < tschellhorn at gmail.com> wrote: > > > Hi! > > > > Your plugin is really great! Thanks. > > > > One more little question. > > Is it possible to add event listeners to the maps via your plugin? > > > > greetings > > /till > > > > _______________________________________________ > > Ym4r-user mailing list > > Ym4r-user at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ym4r-user > > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ym4r-user/attachments/20061107/e497d768/attachment.html
actually the _init methods are only for initialization (when you first create the map). If you want to use rjs, you can have something like this in your rjs (instead of your @marker.event_init(......) in the controller): #First you have to declare (in JS) the marker, so that in JS, the add_overlay and the on_click refer to the same JS variable. page << @marker.declare("my_marker") page << @map.add_overlay(@marker) page << @marker.on_click("function(){ marker.openInfoWindowHtml(''hei'');}") If you use Firefox, I advise you to install the Firebug extension with the show XmlHttpRequest option turned on, so it allows for viewing what happened during the call. guilhem On 11/7/06, Till <tschellhorn at gmail.com> wrote:> > I don''t get it! > Is it right like this? > I think I''m messing around with the @maps and @markers !? > /till > > class MapController < ApplicationController > def index > @map = GMap.new("map_div") > @map.control_init(:large_map => true) > @map.center_zoom_init([59.91106, 10.72223],13) > @map.overlay_init(GMarker.new([59.91122, 10.72217], :title => "Hello", > :info_window => "Blabla!", :draggable => "true")) > end > def shift > @map= Variable.new("map") > @marker = GMarker.new([59.92222, 10.73333], :title => "Update", > :draggable => "true") > @marker.event_init(@marker, :click, "function(){ > marker.openInfoWindowHtml(''hei'');}") > end > end > > shift.rjs: > page << @map.add_overlay(@marker) > > On 11/7/06, Guilhem Vellut < guilhem.vellut at gmail.com> wrote: > > > > Hello, > > Thank you! > > Events are possible. Either through the @ map.record_init "azeazeae" > > (for arbitrary events like domlistener) or through the @map.event_init(@map,:click,"function(){alert(''HOYOYO'');}"). > > The latter will give you: GEvent.addListener(map,"click", > > function(){alert(''HOYOYO'');}) inserted during initialization. > > > > guilhem > > > > On 11/6/06, Till < tschellhorn at gmail.com> wrote: > > > > > Hi! > > > > > > Your plugin is really great! Thanks. > > > > > > One more little question. > > > Is it possible to add event listeners to the maps via your plugin? > > > > > > greetings > > > /till > > > > > > _______________________________________________ > > > Ym4r-user mailing list > > > Ym4r-user at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/ym4r-user > > > > > > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ym4r-user/attachments/20061108/8d0c1017/attachment.html
Ok, thanks for your help. I''ll install the extension later. /till On 11/8/06, Guilhem Vellut <guilhem.vellut at gmail.com> wrote:> > actually the _init methods are only for initialization (when you first > create the map). If you want to use rjs, you can have something like this in > your rjs (instead of your @marker.event_init(......) in the controller): > #First you have to declare (in JS) the marker, so that in JS, the > add_overlay and the on_click refer to the same JS variable. > page << @marker.declare("my_marker") > page << @map.add_overlay(@marker) > page << @marker.on_click("function(){ marker.openInfoWindowHtml(''hei'');}") > > If you use Firefox, I advise you to install the Firebug extension with the > show XmlHttpRequest option turned on, so it allows for viewing what happened > during the call. > > guilhem > > > On 11/7/06, Till <tschellhorn at gmail.com> wrote: > > > > I don''t get it! > > Is it right like this? > > I think I''m messing around with the @maps and @markers !? > > /till > > > > class MapController < ApplicationController > > def index > > @map = GMap.new("map_div") > > @map.control_init(:large_map => true) > > @map.center_zoom_init([59.91106, 10.72223],13) > > @map.overlay_init(GMarker.new([59.91122, 10.72217], :title => > > "Hello", :info_window => "Blabla!", :draggable => "true")) > > end > > def shift > > @map= Variable.new("map") > > @marker = GMarker.new([59.92222, 10.73333], :title => "Update", > > :draggable => "true") > > @marker.event_init(@marker, :click, "function(){ > > marker.openInfoWindowHtml(''hei'');}") > > end > > end > > > > shift.rjs: > > page << @map.add_overlay(@marker) > > > > On 11/7/06, Guilhem Vellut < guilhem.vellut at gmail.com> wrote: > > > > > > Hello, > > > Thank you! > > > Events are possible. Either through the @ map.record_init "azeazeae" > > > (for arbitrary events like domlistener) or through the @map.event_init(@map,:click,"function(){alert(''HOYOYO'');}"). > > > The latter will give you: GEvent.addListener(map,"click", > > > function(){alert(''HOYOYO'');}) inserted during initialization. > > > > > > guilhem > > > > > > On 11/6/06, Till < tschellhorn at gmail.com> wrote: > > > > > > > Hi! > > > > > > > > Your plugin is really great! Thanks. > > > > > > > > One more little question. > > > > Is it possible to add event listeners to the maps via your plugin? > > > > > > > > greetings > > > > /till > > > > > > > > _______________________________________________ > > > > Ym4r-user mailing list > > > > Ym4r-user at rubyforge.org > > > > http://rubyforge.org/mailman/listinfo/ym4r-user > > > > > > > > > > > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ym4r-user/attachments/20061108/c76b3884/attachment.html