Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apple-Control-Region question



As far as I know, control-regions only control whether the widget is can be dragged (moved) by that region.

Ben

On Nov 12, 2005, at 3:27 PM, Ludwig Villiger wrote:

Yes, that's correct! But, why the onmousedown and onmouseup events dont work, when I didnt set a control-region. Another Dashbboard- Dev told me, that I have to set a control-region to register the events.
I think, that it's only a detail and my widget works great with this little bug! The only bug is, that you dont see, that the placeholder is clicked, when the user clicks outside the circle. I can live with that!
Thanks for your help, Ben, and I like your widget! It is very useful!


Cheers!
Ludwig

Am 12.11.2005 um 19:28 schrieb Ben Kazez:

Ah, I think I understand. Let me try to restate it: placeholder.png has a circle in it, and you want the widget to flip when the user clicks in the circle, but not when the user clicks outside it. The control-region stuff is working to prevent the user from dragging within the circle, but the flip code is getting called regardless of whether the mouse is within the control-region.

Is that correct? Assuming it is: The control-region just tells where the user cannot drag the widget; it doesn't limit the where the widget will register mouse events. In order to do this, I think you need HTML image maps. I've never used them, but they're documented here:

http://www.w3schools.com/js/js_image_maps.asp

You should set the mouse events on the <area> tag instead of on the div.

Hope this helps,
Ben

On Nov 12, 2005, at 12:07 PM, Ludwig Villiger wrote:

Now, I included the maximize() function in the onmouseup event. It looks like this:

function hideWiki(event)
{
	event.target.src="placeholder.png";
	var placeholder=document.getElementById('placeholder');
	var frontside=document.getElementById('front');
		
	event.target.frontside.style.display='block';
	event.target.placeholder.style.display='none';
}

When I dont write event.target in the last two lines, then it is like before. It doesnt matter where you click, either on the control-region then on the other space.
The problem is, that I have a placeholder for my widget, which you must be able to drag. And when the control-region is over the whole circle you cant drag. So I set the offset to 20px. When you click on the border of the placeholder you can drag it. But you shouldnt be able to show the widget. That should be only possible when you click on the control-region. Do you understand my problem?
For better understanding is here my html:


<div id="placeholder" onmousedown="showWiki(event);" onmouseup="hideWiki(event);">
<img width="60" src="placeholder.png">
</div>


Ludwig
Am 12.11.2005 um 18:26 schrieb Ben Kazez:

If you want a function to be called when a mouse event happens, one way to make this happen is to put an onmousedown or onmouseup event in the HTML:

<div id="something" onmousedown="buttondown(this);"></div>

This works for images, too. Then your function in JavaScript can change the file the image displays, as you do in buttonclicked and showButton.

I don't understand the names of your functions, though -- what are maximize() and showButton for? So I think we need to see your HTML code as well. Does this help?

Ben

On Nov 12, 2005, at 11:22 AM, Ludwig Villiger wrote:

Can I make something like that:

function maximize(event)
{
	if(event)
		{
			var placeholder=…
		}
}

Please help!
Ludwig

Am 11.11.2005 um 21:47 schrieb Ludwig Villiger:

Hi

I have a problem with the apple-control-region or better with JavaScript. Because one JavaScript-function reacts only when you click on the control-region. But the other JavaScript funktion is called where ever you click. So I'd like to see, that both function are only called when you click on the control-region.
The first function is:


function maximize(event)
	{
		var placeholder=document.getElementById('placeholder');
		var frontside=document.getElementById('front');
		
		frontside.style.display='block';
		placeholder.style.display='none';
		
	}

The function which reacts only, when you click on control- region is:

function buttonclicked(event)
{
	event.target.src="buto1.png";
}

function showButton(event)
{
	event.target.src="buto.png";
}

The first function reacts where ever you click and it should only react when you click on control-region!

I hope you understand my problem and can give some advice!

Ludwig _______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/gugulino1% 40mac.com


This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/kazezb% 40carleton.edu


This email sent to email@hidden


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/kazezb% 40carleton.edu


This email sent to email@hidden


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/kazezb% 40carleton.edu


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Dashboard-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden
References: 
 >Apple-Control-Region question (From: Ludwig Villiger <email@hidden>)
 >Re: Apple-Control-Region question (From: Ludwig Villiger <email@hidden>)
 >Re: Apple-Control-Region question (From: Ben Kazez <email@hidden>)
 >Re: Apple-Control-Region question (From: Ludwig Villiger <email@hidden>)
 >Re: Apple-Control-Region question (From: Ben Kazez <email@hidden>)
 >Re: Apple-Control-Region question (From: Ludwig Villiger <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.