# A question regarding a computers intelligence

#### Macwoni

A question regarding a computers "intelligence"

So I've been reading on Boolean logic and understand to a basic degree as to how the computer calculates it's binary but I would like to know how a computer knows where your icons are on a desktop.How does it know that when you click on save the first time in a window,then shrink the window and click on the save function,how does it actually know where the save function is going to be at all times? I imagine this has to do with the same technology as the mouse being able to move around the screen?

And another question regarding the new i phone,what is it that allows the iphone to have applications that let you interact with what's going on in the screen in relation to how the i phone is positioned? I know there probably won't be any simple answer to both questions but if somebody could point me to the right resources I have no problem taking the initiative to educate myself.Thank you for any help.

Related Computing and Technology News on Phys.org

#### Tanner65

Re: A question regarding a computers "intelligence"

I'd like to be able to answer your first question, but I'm a bit confused about the minimizing.
1. For the most part, when you click the save button it's initializing a class and that class is going to open a form and set itself to be modal (hopefully) so you can't do anything else while that form is open.
2. When you select a location, that location is then verified to not exist, if it does exist then it's going to prompt you to overwrite (which is boolean flag in the class initialization), it passes the string back to the calling application which has been awaiting a response.
3. The file you're saving then is saved to the location that you had entered in the save dialog class.
The mouse moving on the screen is something I don't have any idea about nor really want to figure out. Kinda like Einstein and determining the beginning of the universe, don't want to think about it because it'll worry me. :-)

The iPhone and other phones of that nature have a gyroscope built in that knows which way is down and a compass to determine which direction they're looking. So when the programmer is writing their application they are including an event to trap that direction changing and updating their program accordingly. (That's the easiest way I can say it)

#### SixNein

Gold Member
Re: A question regarding a computers "intelligence"

So I've been reading on Boolean logic and understand to a basic degree as to how the computer calculates it's binary but I would like to know how a computer knows where your icons are on a desktop.How does it know that when you click on save the first time in a window,then shrink the window and click on the save function,how does it actually know where the save function is going to be at all times? I imagine this has to do with the same technology as the mouse being able to move around the screen?

And another question regarding the new i phone,what is it that allows the iphone to have applications that let you interact with what's going on in the screen in relation to how the i phone is positioned? I know there probably won't be any simple answer to both questions but if somebody could point me to the right resources I have no problem taking the initiative to educate myself.Thank you for any help.
Computers see windows and other components differently then you do on a monitor. A computer sees nothing but rectangles. A window is nothing more then a group of rectangles. Windows just keeps up with what rectangles are visible and their locations on a plane (like graphic calculators). Your mouse is associated with a point on the screen. When you click your mouse, the computer calculates what visible rectangle was clicked on, and then calls the function if any exist that is associated with that rectangle.

I'm not familiar with that technology; however, I would guess that it works by using sensors. When the sensors detect a change, they generate a hardware interrupt. When the software sees this hardware interrupt, it does what it is programed to do for that position.

#### mgb_phys

Homework Helper
Re: A question regarding a computers "intelligence"

I would like to know how a computer knows where your icons are on a desktop.How does it know that when you click on save the first time in a window,
Lots and lots of layers of software!
The mouse contains a tiny computer that counts how many times the wheel has moved and sends this to the PC. A bit of the software in Windows (or Linux or MacOSX) called a device driver responds to this and calcualtes the new position of the mosue.
It then tells the graphics layer that the mosue has changed, this then tells the graphics hardware to draw the mouse at a new position.
When you click the button it sends a similair message, then the software resposnsible for the desktop checks if you you clicked inside the area of any of the windows or icons. It then sends a message to the app to tell it there was a mouse click, the application then decides what code to run as a result of a mosue click on that button.
All this explains why on a computer capable of doing billions of operations a second it sometimes seems slow to do something like open a program!

And another question regarding the new i phone,what is it that allows the iphone to have applications that let you interact with what's going on in the screen in relation to how the i phone is positioned?
The iPhone has accelerometers that measure how the device is tilted (wrt gravity) and moved see http://en.wikipedia.org/wiki/Accelerometer

#### ibcnunabit

Re: A question regarding a computers "intelligence"

The mouse moving on the screen is something I don't have any idea about nor really want to figure out. Kinda like Einstein and determining the beginning of the universe, don't want to think about it because it'll worry me. :-)

The iPhone and other phones of that nature have a gyroscope built in that knows which way is down and a compass to determine which direction they're looking. So when the programmer is writing their application they are including an event to trap that direction changing and updating their program accordingly. (That's the easiest way I can say it)

They don't have gyroscopes; they use accelerometers. They're nifty little devices, try Googling them.

#### ibcnunabit

Re: A question regarding a computers "intelligence"

The computer doesn't really "know" where anything is in a the sense that we usually use the word "know," but it is able to determine whether the mouse is in the "icon area." (For one thing, it put the icon there!) As the mouse moves around the screen, it's feeding the x and y coordinates to the system. The icons also have a coordinate system to which the mouse coordinates correspond. Essentially, when the mouse coordinates are within the coordinates of the area defined by the icon (which the computer doesn't even actually "see"), the program or file that the icon is associated with in the computer is able to be selected and run or opened by clicking the mouse. Hope that helps.

Mike

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving