<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: jpopup menus</title>
		<atom:link href="http://cycling74.com/forums/topic/jpopup-menus/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/jpopup-menus/feed</link>
		<description></description>
		<pubDate>Tue, 18 Jun 2013 17:15:18 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/jpopup-menus/#post-58029</guid>
					<title><![CDATA[jpopup menus]]></title>
					<link>http://cycling74.com/forums/topic/jpopup-menus/#post-58029</link>
					<pubDate>Fri, 15 Jul 2011 00:58:21 +0000</pubDate>
					<dc:creator>danieleghisi</dc:creator>

					<description>
						<![CDATA[
						<p>Hello everybody,<br />
I&#8217;m starting to explore the possibilities to have popup menus, but I&#8217;m having some troubles.</p>
<p>I do something like (found in this thread <a href="http://cycling74.com/forums/topic.php?id=31815" rel="nofollow">http://cycling74.com/forums/topic.php?id=31815</a>, thanks Luigi!)</p>
<p>			int screen_x, screen_y;<br />
			t_pt screen; int itemid;</p>
<p>			jmouse_getposition_global(&#038;screen_x, &#038;screen_y);<br />
			screen.x = (double)screen_x;<br />
			screen.y = (double)screen_y;<br />
			itemid = jpopupmenu_popup(mymenu, screen, 2);<br />
			post(&#8220;result : %d&#8221;, itemid);</p>
<p>so apparently the element with ID 2 of mymenu, when I pop it up, should be checked &#8211; but it&#8217;s not! Nothing is checked.<br />
Mymenu is correctly created and filled with</p>
<p>	mymenu = jpopupmenu_create();<br />
	jpopupmenu_additem(mymenu, 1, &#8220;A&#8221;, NULL, 0, 0, NULL);<br />
	jpopupmenu_additem(mymenu, 2, &#8220;B&#8221;, NULL, 0, 0, NULL);<br />
	jpopupmenu_additem(mymenu, 3, &#8220;C&#8221;, NULL, 0, 0, NULL);<br />
	jpopupmenu_additem(mymenu, 4, &#8220;D&#8221;, NULL, 0, 0, NULL);<br />
      &#8230;<br />
and then linked with a font via jpopupmenu_setfont.</p>
<p>Do I miss something?</p>
<p>By the way: when I have submenus linked with the same font, i have the feeling that the top level font is way smaller than the second level one&#8230;</p>
<p>Thanks,<br />
Daniele</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/jpopup-menus/#post-208433</guid>
					<title><![CDATA[Re: jpopup menus]]></title>
					<link>http://cycling74.com/forums/topic/jpopup-menus/#post-208433</link>
					<pubDate>Fri, 15 Jul 2011 05:14:46 +0000</pubDate>
					<dc:creator>nicolas danet</dc:creator>

					<description>
						<![CDATA[
						<p>Hello daniele,</p>
<p>you make a bad assumption : <code>itemid = jpopupmenu_popup (mymenu, screen, 2);</code>  means that itemid should be set with value 2 if NO item is selected by user in the popup. The check stuff is the boolean value in the <code>jpopupmenu_additem</code> function ; for instance : </p>
<pre><code>jpopupmenu_additem (sequencePopup, 1,	"toto", NULL, (x->toto == JOJO), 0, NULL);</code></pre><p>HTH</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/jpopup-menus/#post-208434</guid>
					<title><![CDATA[Re: jpopup menus]]></title>
					<link>http://cycling74.com/forums/topic/jpopup-menus/#post-208434</link>
					<pubDate>Fri, 15 Jul 2011 11:17:10 +0000</pubDate>
					<dc:creator>danieleghisi</dc:creator>

					<description>
						<![CDATA[
						<p>Hello vanille béchamel,</p>
<p>thanks for answering. Actually it happens often that the checked value has to be dynamical.<br />
Imagine this situation: one has 5 staves, and can click on each of them to change its clef (the popup menu is a list of clefs). The menu has to be just one, but I have to set different &#8220;checked&#8221; values when clicking depending on which staff has been clicked. I cannot simply define it once for all in jpopup_additem!</p>
<p>Is there a way to accomplish this?</p>
<p>Thanks<br />
Daniele</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/jpopup-menus/#post-208435</guid>
					<title><![CDATA[Re: jpopup menus]]></title>
					<link>http://cycling74.com/forums/topic/jpopup-menus/#post-208435</link>
					<pubDate>Fri, 15 Jul 2011 16:04:50 +0000</pubDate>
					<dc:creator>nicolas danet</dc:creator>

					<description>
						<![CDATA[
						<p>Hello, </p>
<p>something like that :</p>
<pre><code>#define CLEF_A 1
#define CLEF_B 2
#define CLEF_C 3

...

typedef struct _myObject {
long clef;
} t_myObject;

...

void myObject_new ( )
{
	x->clef = CLEF_A;
}

...

jpopupmenu_additem (clefPopup, 1,	"clef A", NULL, (x->clef == CLEF_A), 0, NULL);
jpopupmenu_additem (clefPopup, 2,	"clef B", NULL, (x->clef == CLEF_B), 0, NULL);
jpopupmenu_additem (clefPopup, 3,	"clef C", NULL, (x->clef == CLEF_C), 0, NULL);

returnedPopupValue = jpopupmenu_popup (clefPopup, locate, 0);

switch (returnedPopupValue) {
case 0	:	break;
case 1	:	x->clef = CLEF_A; break;
case 2	:	x->clef = CLEF_B; break;
case 3	:	x->clef = CLEF_C; break;
}

...</code></pre><p>HTH.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/jpopup-menus/#post-208436</guid>
					<title><![CDATA[Re: jpopup menus]]></title>
					<link>http://cycling74.com/forums/topic/jpopup-menus/#post-208436</link>
					<pubDate>Sat, 16 Jul 2011 16:33:23 +0000</pubDate>
					<dc:creator>danieleghisi</dc:creator>

					<description>
						<![CDATA[
						<p>Thanks Vanille Béchamel, I&#8217;m afraid I didn&#8217;t explain myself properly, sorry.</p>
<p>With your code, at the beginning &#8220;clef A&#8221; is ticked. Suppose that at a given moment one changes the clef into CLEF_B. Now x->clef has become CLEF_B, but there&#8217;s no way to tell the menu that now the first element should not  be ticked any more, and it is the second one which has to be ticked.<br />
I have the feeling that once you add an item, either it is ticked, or it is not, and it&#8217;ll be like that forever.</p>
<p>Except (and this is the solution I&#8217;m using now) if you destroy and recreate menus at each right click!<br />
I just hoped to have a way to &#8220;switch&#8221; the tick in the menus without having to destroy/create them anew (which works perfectly, but I suppose it is more cpu-consuming?)</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/jpopup-menus/#post-208437</guid>
					<title><![CDATA[Re: jpopup menus]]></title>
					<link>http://cycling74.com/forums/topic/jpopup-menus/#post-208437</link>
					<pubDate>Sat, 16 Jul 2011 17:16:34 +0000</pubDate>
					<dc:creator>nicolas danet</dc:creator>

					<description>
						<![CDATA[
						<p>Hello, </p>
<p>if you do not recreate the popup it is a problem, but why not doing it ? </p>
<p>IMHO it&#8217;s a good way, because :</p>
<p>A/ this is a low priority process ; CPU cost of this operation is not significant ;<br />
B/ I typed &#8220;jpopupmenu_create&#8221; on scroogle and i found jamoma&#8217;s sources where it is done like that, so if they do that, we can do that ;-)</p>
<p>HTH.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/jpopup-menus/#post-208438</guid>
					<title><![CDATA[Re: jpopup menus]]></title>
					<link>http://cycling74.com/forums/topic/jpopup-menus/#post-208438</link>
					<pubDate>Sat, 16 Jul 2011 22:38:22 +0000</pubDate>
					<dc:creator>danieleghisi</dc:creator>

					<description>
						<![CDATA[
						<p>Hello, </p>
<p>You&#8217;re probably right! :-)<br />
destroying/Recreating menus is exactly what I&#8217;m doing now, so I&#8217;m also quite happy that I don&#8217;t have to change the structure of my code! :)</p>
<p>There&#8217;s still this issue with the fonts: the same font associated to menus and submenus leads to different sizes. Does it happen to you as well? Is it normal?</p>
<p>Thanks again.<br />
d</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/jpopup-menus/#post-208439</guid>
					<title><![CDATA[Re: jpopup menus]]></title>
					<link>http://cycling74.com/forums/topic/jpopup-menus/#post-208439</link>
					<pubDate>Sun, 17 Jul 2011 05:14:15 +0000</pubDate>
					<dc:creator>nicolas danet</dc:creator>

					<description>
						<![CDATA[
						<p>Hello,</p>
<p>i don&#8217;t have any bad behaviour with fonts ;<br />
i use attributes to set them ; something like that :</p>
<pre><code>#define DEFAULT_POPUP_FONTNAME "Arial"
#define DEFAULT_POPUP_FONTSIZE "14."
#define DEFAULT_POPUP_FONTFACE "0"

#define FONTSIZE_LIST	"8 9 10 11 12 13 14 16 18 20 24 30 36 48 64 72"
#define FONTSTYLE_LIST	"regular bold italic "bold italic""

...

CLASS_STICKY_ATTR (c, "category", 0, "Font");

CLASS_ATTR_SYM (c, "popupfontname", 0, t_tralala, popupFontName);
CLASS_ATTR_DEFAULTNAME_SAVE (c, "popupfontname", 0, DEFAULT_POPUP_FONTNAME);
CLASS_ATTR_STYLE_LABEL (c, "popupfontname", 0, "font", "Popup Font Name");
CLASS_ATTR_DOUBLE (c, "popupfontsize", 0, t_tralala, popupFontSize);
CLASS_ATTR_DEFAULTNAME_SAVE (c, "popupfontsize", 0, DEFAULT_POPUP_FONTSIZE);
CLASS_ATTR_ENUM (c, "popupfontsize", 0, FONTSIZE_LIST);
CLASS_ATTR_LABEL (c, "popupfontsize", 0, "Popup Font Size");
CLASS_ATTR_LONG (c, "popupfontface", 0, t_tralala, popupFontFace);
CLASS_ATTR_DEFAULTNAME_SAVE (c, "popupfontface", 0, DEFAULT_POPUP_FONTFACE);
CLASS_ATTR_ENUMINDEX (c, "popupfontface", 0, FONTSTYLE_LIST);
CLASS_ATTR_LABEL (c, "popupfontface", 0, "Popup Font Style");

CLASS_STICKY_ATTR_CLEAR (c, "category");

...

font = jfont_create (x->popupFontName->s_name, (x->popupFontFace &#038; (1< &lt;1)),
		(x->popupFontFace &#038; (1< &lt;0)), x->popupFontSize);

....

jpopupmenu_setfont (popup, font);
jpopupmenu_setfont (snapPopup, font);
jpopupmenu_setfont (sequencePopup, font);</code></pre><p>I havn&#8217;t tried to set different font for menu and submenus &#8230; but everything seems ok on screen, maybe you should post your code if problem still happens.</p>
<p>HTH</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

