closing PopupMacro's popup window with a second click

36 views
Skip to first unread message

Saverio

unread,
Sep 29, 2010, 11:33:05 PM9/29/10
to TiddlyWiki
How can I make SaqImtiaz's PopupMacro (http://tw.lewcid.org/
#PopupMacro) close the popup window when the button is clicked a
second time?

Tobias Beer

unread,
Sep 30, 2010, 9:33:13 AM9/30/10
to TiddlyWiki
Hi Saverio...

I have modded PopupMacro and uploaded it to a dedicated tiddlyspace
[1]. This Mod by default works when hovering over a popup button,
instead of clicking.

You can find a working example in my MainMenu [2].

If you want it to work 'old fashion style' via click, you have to
either set the macro parameter "nohover" or put something like this in
a zzConfig tagged systemConfig:

config.macros.popup.hover=false;

Cheers, Tobias.


[1] http://popup.tiddlyspace.com
[2] http://tobibeer.tiddlyspace.com

Saverio

unread,
Sep 30, 2010, 4:06:25 PM9/30/10
to TiddlyWiki
99% there, thank you!! However, re-clicking a *nested* popup button
closes the *parent* popup panel. I have a tiddler as follows which
popups a list of notes, some of which are tagged with a particular
"topic", others of which are unassociated with a topic. The intended
display is first to list the topics, which are themselves popups to
the list of notes tagged to that topic, followed by a popup button for
the unassociated notes:

<<popup Notes [[<<tiddler ##Notes$))]]>>/%
!Notes
<<matchTags {{"<<popup '%0' [[<<tiddler ##TopicNotes with:%0$))]]\>
\>"}} "" topic>>
<<popup "Unclassified notes" [[<<tiddler ##UnclassifiedNotes$))]]>>
!TopicNotes
<<matchTags '[[%0]]' '' note AND $1>>
!UnclassifiedNotes
<script>
var topics = store.getMatchingTiddlers('topic');
var tagfilter='note', out='';
for(var t=0; t<topics.length; t++) { tagfilter += ' AND NOT ' +
topics[t].title; }
var notes = store.getMatchingTiddlers(tagfilter);
for(var t=0; t<notes.length; t++) { out += (t>0?'\n':'') + '*[[' +
notes[t].title + ']]'; }
return out;
</script>
!end%/

Tobias Beer

unread,
Sep 30, 2010, 7:56:20 PM9/30/10
to TiddlyWiki
Hi Saverio,

Mhhh, the usual suspects ...things never quite work out right away ;o)

Would you mind uploading or sending me an example wiki so that I don't
have to rebuild your case?

Cheers, Tobias

Saverio

unread,
Oct 5, 2010, 3:37:30 PM10/5/10
to TiddlyWiki
Sorry for the delay. Here is an example: http://dl.dropbox.com/u/4462381/popup.html

Tobias Beer

unread,
Oct 6, 2010, 12:56:01 PM10/6/10
to TiddlyWiki
Hi Saverio,

Let me tell you, this was not pretty ...although the result is. ;o)

After hours of pulling my hair out over infinite loops and rethinking
on how to best rewrite Saq's code from scratch, I've got the baby
working the way you initially hoped... meaning: click-toggle as deeply
nested as you want.

Now, I have changed the code quite a bit in that there no longer are
any id's given to popups. Instead it's all (!) classes and what's
more... they count up nicely!!!

There are new parameters:'defaultValue' ...namely:
arrow:'\u25BC'
popClass:'popup'
btnClass:'popbutton'

When popups and buttons are created they not only get those classes
assigned but depending on their nesting level they also get...

level1: popup1 / popbutton1
level2: popup2 / popbutton2
etc...

...whereas if you defined popClass as myPopup, then it would be
myPopup1, myPopup2, etc...

That way you can have one nested popups thingy that is horizontal and
another one being vertical and you can easily style the different
levels via css as I have done in your document reuploaded here [1].

The arrows are now in their own container floating to the right with a
classname of "poplevel". Having those as a parameter allows you to
have different arrows for different nesting levels.

Note that all styles should be put into StyleSheetPopup.

I will later on release the thing ... maybe with hover again, if I get
that to work properly.

Cheers, Tobias.

[1] http://dl.dropbox.com/u/2040050/group/2010.10.06%20popup%20saverio.html

Saverio

unread,
Oct 7, 2010, 3:26:05 PM10/7/10
to TiddlyWiki
I have not tried more than single-level nesting, but seems to work
perfectly so far! Thank you!

Saverio

unread,
Oct 9, 2010, 9:52:41 PM10/9/10
to TiddlyWiki
By the way, what you have done here also should be applicable to your
TagSearchPlugin/QuickOpenTagPlugin combo (when you use the down arrow
to display a list of tiddlers with a certain tag).

On Oct 6, 12:56 pm, Tobias Beer <beertob...@googlemail.com> wrote:

Tobias Beer

unread,
Oct 11, 2010, 5:04:33 PM10/11/10
to TiddlyWiki
You're right. Compared to PopupMacro it should be a minor effort to
have it 'click-toggle' ...so I've put it on the todo-list.

Cheers, Tobias.
Reply all
Reply to author
Forward
0 new messages