Author: eallen
Date: 2009-03-31 10:06:24 -0400 (Tue, 31 Mar 2009)
New Revision: 3245
Modified:
mgmt/trunk/notes/fullpage widgets.txt
Log:
Added info about calling a javascript function when a widget is made full page and
restored.
Modified: mgmt/trunk/notes/fullpage widgets.txt
===================================================================
--- mgmt/trunk/notes/fullpage widgets.txt 2009-03-31 13:31:54 UTC (rev 3244)
+++ mgmt/trunk/notes/fullpage widgets.txt 2009-03-31 14:06:24 UTC (rev 3245)
@@ -23,8 +23,12 @@
<p class="explain fullpageable">
{important_stuff}
</p>
-
-Background updating of widgets and fullpage:
+
+If you need to be notified when the widget is made full page, there are two mechanisms:
+1) Notify the python code that the widget is now in full page mode. This lets the widget
render itself based on it's container size.
+2) Notify the javascript code. If the widget doesn't auto-update, this lets you
adjust the widget's presentation in javascript.
+
+1) Background updating of widgets and fullpage:
Sometimes the HTML you want to make fullpagable will contain one or more widgets.
If those widgets get automatically updated (using self.update_enabled = True),
AND you want the widgets to be aware of when they are being rendered full page, you
need
@@ -45,6 +49,12 @@
# if width is None, we are not in fullpage
# if width has a value, we are in fullpage and width is the available size in
pixels
+2) To have a javascript function called when the widget is made full page, add the
onfullpage and onrestore attributes to the widget.
+For example:
+ $('slot_visualization').onfullpage = function (width) { vis.notify(true,
width); };
+ $('slot_visualization').onrestore = function () { vis.notify(false,
original_clip_size); };
+The width passed to the onfullpage function is the new width of the widget when in full
page mode.
+
How it looks:
A block of HTML that is fullpageable will have a special mouseover style.
When the mouse if over any part of the HTML, there will be a light purple bar at the
top of the HTML with a
Show replies by date